| Author |
Storage / Retrieval of mandarin from a flat file
|
dwarakanathan thiru
Ranch Hand
Joined: Oct 14, 2009
Posts: 49
|
|
Hi All,
I have tried a number of attempts before coming here on the topic I have mentioned.
I work on JBoss portal. And my requirement is to have a module which allows you to paste MANDARIN charcters (Example: 喂 See, it does not come here !!) in a text box and then save it in a flat file on the server. I do not want to use the resource bundle for some reasons
Whatevere I paste (but displays properly in the JSP), gets saved as junk values in the text file. Any code that works good?
Also, If in case i store the ascii values say /u4444 format in the text file instead of trying to store the chinese symbol directly.
How to decode it to get the actual chinese symbol?
I have learnt about usage of utf8. But still no clue.
Please let me know on this.
|
Thanks,
Dwarak T
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
dwarakanathan thiru wrote:See, it does not come here !!
I can see it just fine.
I have learnt about usage of utf8. But still no clue.
But UTF-8 is not the Chinese charset. Check out charset.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
I can also see the Chinese character in my browser just fine.
dwarakanathan thiru wrote:Whatevere I paste (but displays properly in the JSP), gets saved as junk values in the text file. Any code that works good?
Are you sure that the content of the text file is wrong, or is the software that you are using to view the text file not showing it correctly? Is the software that you use to display the file using a font that contains the Chinese characters?
Note that for example the Windows command prompt usually doesn't display non-ASCII characters very well, so if you do "type filename.txt" you'll most likely see question marks or garbage when the file contains non-ASCII characters.
Try using a good text editor (for example Notepad++) to view the text file.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Storage / Retrieval of mandarin from a flat file
|
|
|