[Mono-list] Passing UTF-8 to a method that takes a .Net string - not possible right?

nev nevdelap at gmail.com
Wed Oct 13 01:33:39 EDT 2010

Hi all,

I don't see a Mono.Cairo forum, so hopefully this is the right place to

As I understand it .Net strings are UTF-16, and converting them to UTF-8
renders a byte array, and to get them back to strings they have to be
converted back to UTF-16. If I'm wrong stop me here.

So I've been using Mono.Cairo.Context.ShowText() which takes a string. On
Linux everything is good, never had a problem.

But running my assemblies on Windows with the Mono assemblies from the
Windows Mono installer everything works - except that ShowText() has issues
with accents and guillemets (and maybe other things). (Trying to output them
prevents any further drawing operations from working on the context.)

So I discover that the doco says "A drawing operator that generates the
shape from a string of UTF-8 characters, rendered according to the current
font_face, font_size (font_matrix), and font_options."

Is this possible? It takes a .Net string, .Net strings are UTF-16, but it
needs UTF-8?

Can someone confirm that there is something wrong here, or tell me what I'm

Thanks in advance,

View this message in context: http://mono.1490590.n4.nabble.com/Passing-UTF-8-to-a-method-that-takes-a-Net-string-not-possible-right-tp2993098p2993098.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list