[Mono-bugs] [Bug 71770][Maj] New - Problem with UTF-8 strings and Cocoa#

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 26 Jan 2005 04:50:43 -0500 (EST)


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 edwardjsabol@iname.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71770

--- shadow/71770	2005-01-26 04:50:43.000000000 -0500
+++ shadow/71770.tmp.16903	2005-01-26 04:50:43.000000000 -0500
@@ -0,0 +1,43 @@
+Bug#: 71770
+Product: Cocoa#
+Version: unspecified
+OS: 
+OS Details: Mac OS X 10.3.4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Bindings.
+AssignedTo: grompf@sublimeintervention.com                            
+ReportedBy: edwardjsabol@iname.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problem with UTF-8 strings and Cocoa#
+
+The attached test case reads an XML file (originally created with System.Xml.Serialization's 
+XmlSerializer) using XmlDocument. The XML file specifies encoding="utf-8". When I pass these 
+C# strings to a DataSource connected to a NSOutlineView, however, the UTF-8 characters in 
+some of the entries are not displayed properly. It looks like they're being displayed as if the 
+encoding were not being taken into consideration. Basically, the .xml file has two bytes (hex: 
+C2 92) where all the single quotes are in the XML elements. I assume that's the UTF-8 encoding 
+for a single quote. In the NSOutlineView, I see two characters: a dingbat of some kind, followed 
+by a lowercase "i" with an accent mark. When the same string is printed using Console.WriteLine, 
+I see only a single character (a "?", but that might be due to my font choice) in my Terminal 
+window where the two bytes are located.
+
+kangaroo <grompf@sublimeintervention.com> on the cocoa-sharp mailing list wrote:
+
+Ok I think I know what the problem here is; our string hiding does new NSString (str).Raw;
+which is:
+
+public NSString(string str) :  
+this((IntPtr)ObjCMessaging.objc_msgSend 
+(NSString_classPtr,"stringWithCString:",typeof(IntPtr),typeof 
+(string),str),false) {}
+
+which in your case should be
+stringWithUTF8String:
+
+We'll have a chat about this (me and urs) tomorrow and think about how to handle