I am trying to draw some greek characters using graphics.drawstring. This works well for UTF-8 characters that require only a single byte, but when I try to draw a string that is double byte, I fail.
For example, the lowercase greek alpha is represented in UTF-16 as alpha = &u03b1, where alpha is a string. This prints just fine, but if I try to draw the string using
canvas.graphics.drawstring alpha
I get a “?”. This is true for all characters that use two bytes. So I am obviously doing something wrong. Can anyone help?
Is the data to be printed coming from an outside source like a database or a text file? Then make sure that the strings have the right encoding, for example if they come in as UTF-16, you would have to convert it:
Dim utf8String As String = incoming.DefineEncoding(Encodings.UTF16).ConvertEncoding(Encodings.UTF8)