• 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

Problem with Japanese Characters.

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I need to read some Japanese characters from a Flat file and dispaly it on UI,
now i write a Japanese character and convert it to Ascii ( using nativetoascii ). so i get a lot of / u stuff.... but when i am reading from this FF and trying to display it on UI i see / u things insteed of Japanese Characters,
any pointers where am i missing something?
Regards
Gaurav
_ will work for love _
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The purpose of nativetoascii is to let you write code using native character sets, then translate it to ASCII for compilation. The "javac" compiler needs non-ASCII characters to be escaped.
But Java's I/O system can read the native characters directly (otherwise nativetoascii, written in Java itself, wouldn't work, right?) Data files don't need to be run through nativetoascii, and in fact, the \u0000 escape sequences don't mean anything to Java's I/O system, only to the compiler.
So don't translate your file before reading it. If Java can't seem to read it correctly unchanged, then you may need to fiddle with character set encodings, but you shouldn't need to modify the data file itself.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Swing UI is designed to take unicode characters and display them correctly as long as the proper font is installed. As Ernest pointed out, you don't need nativetoascii to get this to work.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic