Home >Java >javaTutorial >What should I do if the rare characters are garbled when Java reads XML?

What should I do if the rare characters are garbled when Java reads XML?

coldplay.xixi
coldplay.xixiOriginal
2020-08-21 10:18:573530browse

Solution to the problem of garbled characters when Java reads XML: First open the XML file with Notepad and change [encoding="gb2312"] in the first line to [="utf-8" 】; Then save it as, and change the encoding method from ANSI to [UTF-8]; finally, when you use the program to read it, the output will be normal.

What should I do if the rare characters are garbled when Java reads XML?

Solution to the problem of garbled characters when java reads XML:

Use Notepad to copy the XML file Open it, change the encoding="gb2312" in the first line to encoding="utf-8" , then save it as, change the encoding method from ANSI to UTF-8, and when reading it with the program, the output will be normal. solve.

What should I do if the rare characters are garbled when Java reads XML?

Related learning recommendations: java basic tutorial

The above is the detailed content of What should I do if the rare characters are garbled when Java reads XML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn