[Mono-list] string encoding

Marcus mathpup@mylinuxisp.com
Mon, 23 Jun 2003 01:29:05 -0500


I'm not sure that using UTF-8 for Ansi is the right thing, especially since 
Rotor does not perform encoding into UTF-8 using marshaling with 
CharSet.Ansi. For example,

myFunction( "\xD0" + "ABC" );

where myFunction is

[DllImport("libchar2.so", CharSet=CharSet.Ansi)]
    private static extern void myFunction(string s);

And myFunction simply prints out the contents of the string it is passed, I 
get very different output with Mono versus Rotor:

mono char2.exe:

Char value = 195(Ã)
Char value = 144()
Char value = 65(A)
Char value = 66(B)
Char value = 67(C)



clix char2.exe:

Char value = 208(Ð)
Char value = 65(A)
Char value = 66(B)
Char value = 67(C)



On Sunday 22 June 2003 4:37 pm, Miguel de Icaza wrote:

> Today the mappings Mono uses are as follows:
>
> 	Ansi -> UCS-2 to UTF-8 conversion.
> 	Unicode -> UCS-2 to UCS-2
> 	Auto -> Same as ANSI.