[Mono-devel-list] Re: [patch] support utf8 strings in c# module

Jonathan Pryor jonpryor at vt.edu
Tue Nov 2 23:17:01 EST 2004

On Tue, 2004-11-02 at 21:05, Joel Reed wrote:
> thanks Rafael. what i'm referring to is .Net String's which have been
> initialized with C/C++ strings via pinvoke, in particular i was examining
> Marshal.PtrToStringAnsi and Marshal.PtrToStringUni.

A good fix for this would be to modify
ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (in
mono/metadata/marshal.c) so that it usees mono_unicode_from_external()
(declared in mono/utils/strenc.h).  This way, it will examine the
MONO_EXTERNAL_ENCODINGS environment variable to determine how the string
should be marshaled, with UTF-8 being the default.

This would likely be a 5-10 line change, for anyone interested in
writing such a patch...

 - Jon

More information about the Mono-devel-list mailing list