• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Storage / Retrieval of mandarin from a flat file

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic