I created a text editor for JavaFx which is painting the text on a Canvas, gyph by glyph. I use String.codePointAt(i) to correctly load the glyphs. Somehow the first glyph is a strange one, I don't know why. The file was loaded using Charset UTF-16 LE
Here is the rendered string, the first glyph is strange:
And here you can see the textLine and ch bytes after the first character:
And here is the code I use to iterate a text line:
int i = 0;
while (i < textLine.length()) {
int codePoint = textLine.codePointAt(i);
i += Character.charCount(codePoint);
String ch = Character.toString( cp );
graphicContext.fillText( ch, x, y);
}
Is this code wrong or it is an encoding and file issue?