Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes International  character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "International  character " Watch "International  character " New topic
Author

International character

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
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
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

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

Joined: May 17, 2004
Posts: 107
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: International character