Hi Brian,
1. Make sure you have "<?xml version="1.0" encoding="UTF-8"?>" defined for
your encoding in your file.
2. Are you sure that the special characters are actually UTF-8 characters
and not some goofy windows/esoteric character encoding? I have seen issue
arise when copying and pasting from Word documents, etc. One thing that
always got me is that Eclipse?s default char encoding on windows *IS NOT*
UTF-8. If you are using Eclipse to work with your XML (or any other text
for that matter), you should adjust the general editor settings like so:
Window > Preferences > General > Editors: Change the ?Text File Encoding?
from ?Default (Cp1252)? to ?Other? and select ?UTF-8? from the list. This
should solve any cutting/pasting issues you might run into as Eclipse seems
to be able to automatically convert into UTF-8 when set up correctly.
Some things that may help us better understand your issue.
- Might be helpful if you posted the specific error you are getting.
- Does this happen on reading from XML, writing to XML or both?
Hth,
-Scott
________________________________________
From: Brian Engel [mailto:Brian.Engel@xxxxxxxxxxxx]
Sent: Thursday, November 10, 2005 12:24 PM
To: users@xxxxxxxxxx
Subject: [cinjug-users] XML/Java Question
I am running into a problem where I have special (international) characters
in attribute for an XML tag.
i.e. <MyTag theAttribute="Señor Gómez" />
I presume I need to encode the string somehow, how can I do this in Java?
Thanks for any help...
Brian Engel
|