[Mono-bugs] [Bug 56965][Maj] Changed - P/Invoke is marshalling string arrays as UTF-8 not Unicode
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 19 Apr 2004 17:39:16 -0400 (EDT)
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 cscholes@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=56965
--- shadow/56965 2004-04-19 17:34:18.000000000 -0400
+++ shadow/56965.tmp.6665 2004-04-19 17:39:16.000000000 -0400
@@ -120,6 +120,22 @@
string encoding used by a delegate but I don't know how.
------- Additional Comments From cscholes@novell.com 2004-04-19 17:34 -------
Created an attachment (id=7431)
Updated managed code with correct delegate marshalling
+
+------- Additional Comments From cscholes@novell.com 2004-04-19 17:39 -------
+The attached file (id=7431) now works in .NET. I was trying a bunch
+of things and forgot to add the MarshalAs param back. The delegate
+signiture now looks like:
+
+public delegate void delegateAddHit(bool isAuthorized, [MarshalAs
+(UnmanagedType.LPWStr)] string url);
+
+The unmanaged code calls the callback with Unicode characters. It
+works in .NET but does not in Mono. If I call the callback in mono
+with a string like:
+char[] uchars = {'\u304C','\u898B','\u3064','\u304B','\u308A'};
+String ustr = new String(uchars);
+The parameter is NULL.
+