[Mono-list] Why UTF-16 strings in Mono.Unix?

Brion Vibber brion at pobox.com
Mon Oct 17 20:04:42 EDT 2005


Jonathan Pryor wrote:
> On Mon, 2005-10-17 at 19:03 +0200, Florian Weimer wrote:
>>Why are UTF-16 strings used in Mono.Unix?  Doesn't this mean that some
>>resources are inaccessible to programs running under Mono in a
>>multibyte localeq (such as one using UTF-8)?
>
> Care to elaborate?  System.String is always used to represent strings in
> Mono.Unix and Mono.Unix.Native, but Mono's marshaler will convert the
> strings to UTF-8 for the P/Invoke call.

A peek at Mono.Unix/UnixMarshal.cs hints that managed strings are
marshalled to/from the locale encoding (assuming Encoding.Default is the
locale encoding); so locales other than UTF-8 ought to also work.

Florian, for some background on how CLI/.NET/Mono code interfaces to
native code, and specifically how paramters of various types are handled
see:
http://www.mono-project.com/Interop_with_Native_Libraries

-- brion vibber (brion @ pobox.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20051017/e8d6f419/signature.bin


More information about the Mono-list mailing list