From: Sam R. <sro...@un...> - 2003-03-21 03:06:36
|
+ What does NSString.to_s do when the string isn't ASCII? I initialized it with a UCS-2 string with an accented e (e'): irb(main):045:0> s = OSX::NSString.alloc.initWithCharacters("\x00\x64\x00\xe9\x00\x70", :length, 3) #<OSX::OCObject:0xcad6c class='NSCFString' id=0x227ea0> irb(main):046:0> s.to_s "d\216p" Where does \216 come from? I thought it might be the latin1/iso-8859-1 encoding of an e', but it isn't. irb(main):050:0> s.UTF8String "d\303\251p" I think having to_s return a UTF-8 string as the default would be a good policy! Any other choice is going to leave some character sets out. Any thoughts or explanations? Sam |