Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • 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
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic