exception caused by file encoding

Source: Internet
Author: User
Tags ultraedit exception caused by file exception caused by SUN XML IBM JDK Weblogic file encoding
If you don't use the IBM JDK, you're still experiencing this problem.
If your exception occurs when parsing XML, if your exception is somewhere where there is no.
For example, there is no inside Tomcat, WebLogic. Or this domain has that domain but not. And indeed the same application.
You may have the same problem as the writer.

Your XML file itself is UTF-8 encoded (note that the file is UTF-8 encoded, not the file content specified in the XML file is UTF-8 encoded).
Your XML file contains Chinese.
You use UltraEdit to edit the XML file.
Delete Chinese, the problem remains.

Then you can be sure that your question is the one I'm going to talk about.

First give the solution:
Programme I:
1.xml is opened with Notepad to remove the Chinese inside.
2. Create a new TXT file in Windows Local and use Notepad (note that you cannot use UltraEdit) to open it.
3. Copy the contents of the XML into the new TXT file.
4. The name of the TXT file as an XML file. Overwrite the original XML file
5. To see if the problem is solved, click the Magic Bar.

Scenario Two: (For those who use the Eclipse IDE, other programs that can change the file encoding are OK, but not tested)
1. Cut out the contents of the XML file, save it elsewhere, whatever file is OK, and finally txt. Leave an empty XML file
2. Modify the encoding of the empty XML file into GBK. Note that the encoding of the file is not the declaration of XML. Of course, it has been deleted here.
3. Do you see the head of the file is garbled at this time? Delete them!
4. Bake back the contents of the original document
5.ok problem resolution, this method does not remove Chinese.

The root of the problem:
Some people have already figured out what the reason is. Oh, that is the XML file that BOM header caused by this problem.
Oh. There's nothing to understand. The following details are described below:
The XML file is divided into two types, one with BOM information, which indicates that the file is in XML format
There is also no BOM information in the XML file.
This particular BOM information causes parsing XML errors.
What does that have to do with UltraEdit? UltraEdit automatically adds this hateful BOM message when editing an XML file.
Posted on 2008-05-21 22:22 Fall nicety Read (3986) Comments (4) Edit Favorites Categories: basics, debugging related


# Re: anomalies caused by file encoding 2008-07-09 16:38 Ironwan
Can you modify the code to solve the problem.  If the customer is using our system, let them do so they are definitely against AH. Reply to more comments

# Re: File encoding caused by anomaly 2008-07-09 18:35 Fall nicety
The root of this problem should be related to file resolution.
You can try to modify these, but it's more difficult. I didn't try to reply to more comments

# Re: exception caused by file encoding [not logged in] 2009-04-12 17:47 ws
If it is because of the use of IBM's JKD (native), and incompatible with the program how to solve this problem reply to more comments

# Re: File encoding caused by anomaly 2009-07-13 15:04 Fall nicety
You are the problem with IBM JDK IO.
Add parameters to reply to more comments

It's the IBM JDK, plus an execution look at

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.