Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=77746 --- shadow/77746 2006-03-09 13:07:22.000000000 -0500 +++ shadow/77746.tmp.1710 2006-03-09 13:07:22.000000000 -0500 @@ -0,0 +1,39 @@ +Bug#: 77746 +Product: Mono: Class Libraries +Version: unspecified +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: CORLIB +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: StringToCoTaskMemAnsi uses Latin1 rather than UTF-8 encoding + +System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi uses Latin1 +encoding rather than UTF-8. It should wrap StringToHGlobalAnsi, which does +the right thing, except that on Windows it should then copy the result into +a CoTaskMem-allocated buffer. + +Here's a test case. The first line prints null because the encoding can't +be undone. It should print a u-with-umlauts. The second line prints 0xFC, +which is the ANSI code for the character. It should print something else, +the start of a UTF-8 two-byte encoding of the character. + +using System; +using System.Runtime.InteropServices; + +public class Test { + public static void Main() { + string u = ((char)0xFC).ToString(); + Console.WriteLine(Marshal.PtrToStringAnsi(Marshal.StringToCoTaskMemAnsi(u))); + +Console.WriteLine(Marshal.ReadByte(Marshal.StringToHGlobalAnsi(u)).ToString("x")); + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
