Link to home
Start Free TrialLog in
Avatar of megloff
megloff

asked on

Unicode Problem with German characters "Umlaute"

Hello there !

I'm creating a application with xerces, xalan using the Java XML API. I use DOM to create an XML document.

Unfortunately the special German characters as like as "Umlaute" (ä.ö.ü) are not written correctly in the xml document. For example the "ü" character is translated in a stupid unicode value "&#xfffd" which is not correct. The correct value is for example "&#x00FC" or the character value himself So it seems that there is a kind of an overflow?

I create especially an iso-8859-1 encoding output during the serialization of my DOM document.
For this I'm using
http://xml.apache.org/xerces-j/apiDocs/org/apache/xml/serialize/OutputFormat.html
the OutputFormat Class and set the encoding to
OutputFormat.setEncoding("iso-8859-1")

and after that the XMLSerializer to produce the outputstream
http://xml.apache.org/xerces-j/apiDocs/org/apache/xml/serialize/XMLSerializer.html
XMLSerializer.setOutputFormat(OutputFormat)


So my question is now, what Do I wrong? Why are my special characters not written correctly in the xml document? Have I to initialize something during my DOM creation ?

Thank you in advance
Mark


 









Avatar of PeterCiuffetti
PeterCiuffetti
Flag of United States of America image

Hi,

How do these characters get into the DOM in the first place?  Are you reading them from a file?  The way I understand it, the DOM is unicode, it has no transparent encoding--encoding is an act that is only necessary when serializing the internal representation for the purpose of storing the document in an external representation (a file, a network message).  So it is also possible that the characters are not being inserted into the DOM correctly.
Avatar of klausbert
klausbert

Avatar of megloff

ASKER

Thanks all for your comments.

I have solved this problem in the meantime. It was simple.

java -Dfile.encoding=[yourcharacterset]

Because Sun Platforms has not as default german windows platfroms the iso 88591 character set.

regards
Mark
Avatar of Zlatin Zlatev
Moderators - this is for deletion
zlatev,

Please do NOT propose an answer for a question which may or may not be deleted. Just messes up the works.

Thanks,
Netminder
CS Moderator
@Netminder, the message before mine is clear enough:
"I have solved this problem in the meantime"
So this question is for deletion or for closing another way I think.

Also please suggest me another way to help you in moderating these types of questions. Note that sometimes I read the same question more than one time (because it is left as Unanswered question), and loose MY time (I do not earn my money from EE) in reading such questions that should be closed in one way or another.

Kind Regards,
Zlatin Zlatev, MCSD
<bemused smile> I don't earn any money from EE either; none of the Moderators do, nor do any Experts that I know of.

If you'd like to help in the clean up effort, please see the following questions:
https://www.experts-exchange.com/questions/20307063/FAQ-for-cleanup-volunteers.html
https://www.experts-exchange.com/questions/20331368/SCRITPS-most-commonly-used-Standardize-these-into-2-3.html
https://www.experts-exchange.com/questions/20331378/STANDARDIZE-PROPOASALS.html

In brief, a question is considered "abandoned" when the Asker does not respond for three weeks following the date of the last Expert comment, OR when a participating Expert fails to respond to a follow-up question by an Asker for the same amount of time. At that point, you may leave a comment that does the following:
1. Lets all participants know that you're going to recommend the question be closed.
2. Lets all participants know what you think should be done with the question -- see below for your options in that regard.
3. Sets a deadline -- we recommend one week -- for the participants to respond to your post. We also suggest that you put a sentence that says "do not select this comment as an answer" in the comment.

Once you've done that, you can post a question in the Cleanup TA with a list of all of the questions you've looked at; please see https://www.experts-exchange.com/questions/20359061/Cleanup-154-Due-2002-09-23.html for a sample. You might want to look at some of the questions to see how this particular Expert proposes his recommendations as well.

The closure recommendations, in no particular order, are:
Close/Award: Give the points to one or more Experts. It should be noted that splits are a royal pain, but we'll do them when necessary.
Delete: When the question and responses have no value to the PAQ, deleting is fine. Note that the Asker's points are refunded. A variant on this is the Delete/No Refund, in which the Asker's points are NOT refunded for whatever reason.
PAQ/Refund: When there is a lot of good information, but the Asker doesn't get an answer, or if the Experts don't come back to finish helping.
PAQ/No Refund: Same as above, except that the Asker doesn't come back. We do this one a lot.

Please note that as an Expert, you'll only be recommending to the Moderators. While we usually go with the recommendation, we don't always, for one or another reason.

Hope this helps.

Netminder
CS Moderator
To @megloff, @klausbert and @PeterCiuffetti:

I am going to sugest this question to be closed in 7 days (marked as PAQ) and points refunded to the asker (@megloff), because he solved his question meanwhile.

The solution was:
________
java -Dfile.encoding=[yourcharacterset]

Because Sun Platforms has not as default german windows platfroms the iso 88591 character set.
________

If any of you have any objections you have time till 14.Oct.2002 to post them here.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

@Netminder: My suggestion will be PAQ/Refund and I will make it after 14.Oct.2002

Kind Regard,
Zlatin Zlatev, MCSD

_____
P.S.
@NetMinder, I am aware that none of the Moderators earn money from EE, nor do any Experts... My point was:
I cannot remmeber what questions I have read, and in which of them I am not interested in (anymore). When I read such question many times, I am definetly not happy with that fact. I wish to have ability to change the status of this messages (maybe to add them to some kind of ignore list) so that I am not able to read them again in the UnlockedQ list.
Hope you will get my idea now. Maybe I should make this as suggestion in support area?
zlatev,

If you look below the Submit button (below the box into which you type your comments), you'll see a button which says Unsubscribe. This is only true in questions which have not been closed. Clicking the Unsubscribe button will stop the emails.

Netminder
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial