In this post, we will see how to resolve How to convert codepoint of one charset to another in Java?
Question:
I am trying to convert codepoints from one charset to another in Java.For example character
ř
is 248 in windows-1250
, 345 in unicode
.So I have source charset and source codepoint and target charset and want to calculate target codepoint.
This may sound easy as windows-1250 is single byte, but I want it to work on any charset, like
GB2312
.I guess it can be done somehow with
Charset
class,
but it seems that it only converts bytes, not actual code points.Thanks in advance for any help.
Best Answer:
At least in Java there is no notion of codepoints for character sets other than Unicode. You have to convert the integer to byte array and then to unicode.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review