• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Need help with Charset class issue ... :-)

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi JavaGurus!

I am trying to convert two characters in the Big5 character set, 0xA2CF and 0xa55f that correspond to the characters A and 北, to the equivalent characters but in the Unicode character set.

The code is:



The output in the DOS prompt is:


Not the two characters A and 北, encoded in Unicode, that I had expected. There is not even two ?? but one ? ... meaning the data is being interpreted as one character.

What am I doing wrong?
Any help is hugely appreciated.
Thanks in advance! :-)

Best regards
 
Sheriff
Posts: 28395
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you're on the wrong track entirely.Okay, enough of that. The main point is that there's no such thing as a "Big5 character" in Java. All characters in Java are Unicode characters. It is possible to encode Java characters as a stream (or array) of bytes using Big5, and it's possible to decode those bytes back into Unicode characters using Big5 as well. Perhaps something like this:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic