Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

International character  RSS feed

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to out put the original international string in DB "Si C�tait Hier"? now it is printed out as "Si C��tait Hier" in XML.

Thanks,
 
Paul Clapham
Sheriff
Posts: 22267
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you output that string in an XML file that's encoded in UTF-8? Then there is nothing wrong with your XML file. What is wrong is that you are "printing it out" using some tool that doesn't realize that is encoded in UTF-8 and treats it as if it were encoded in some other encoding, perhaps ISO-8859-1 or Windows-1252 for example.
 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The XML file has created with FileWriter(exportFile), the output just use _writer.write(ch) for each char, since we need to handle some special character like < > & | .

data is extracted from Oracle DB. The string in DB is "Si C�tait Hier"(that is what I hope to display), it was put in two XML files. If I use vi edit file, it display as "Si C��tait Hier1" in both files. But when I use IE browser to look, it display Si C�tait Hier" in one file and "Si C��tait Hier1" in another file.

Also if I do the convert with URLDecoder.decode(URLEncoder.encode(str, "UTF-8"), "UTF-8"), it could display "Si C�tait Hier" in IE browser, but still looks as "Si C��tait Hier1" with vi editor.

I am totally confused with it. Could any one give me some hints why that happens?

Thanks,

Steve
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!