Satoshi Nakagawa
snaka****@infot*****
Tue Nov 6 20:51:25 JST 2007
Hi Kimura-san, > I think String#to_nssting/nsencoding should be expired... I agree. I think we can assume $KCODE = 'utf8' at least on OS X. So I suggest that we should make NSString.guess_*encoding methods deprecated. >> Not good, but not fatal: >> >> irb(main):001:0> "\270\236\010\210\245".to_nsstring >> => nil >> >> Very not good: >> >> irb(main):001:0> "\270\236\010\210\245".to_ns >> /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ >> ruby_addition.rb:70: [BUG] Bus Error >> ruby 1.8.6 (2007-06-07) [universal-darwin9.0] In Cocoa semantics, binary strings should be represented in NSData. So I think, if a string has illegal UTF-8 sequences, conversion functions should return nil or raise an exception. -- Satoshi Nakagawa On 2007/11/05, at 23:02, kimura wataru wrote: > Hi, > > String#to_nssting/nsencoding depends on nkf module. > nkf module can handle the following encodings. > > [ruby-1.8.6 ext/nkf/nkf.c] > /* Encoding Constants */ > #define _AUTO 0 > #define _JIS 1 > #define _EUC 2 > #define _SJIS 3 > #define _BINARY 4 > #define _NOCONV 4 > #define _ASCII 5 > /* 0b011x is reserved for UTF-8 Family */ > #define _UTF8 6 > /* 0b10xx is reserved for UTF-16 Family */ > #define _UTF16 8 > /* 0b11xx is reserved for UTF-32 Family */ > #define _UTF32 12 > #define _OTHER 16 > #define _UNKNOWN _AUTO > > > I think String#to_nssting/nsencoding should be expired... > > On Mon, 5 Nov 2007 12:15:03 +0100, Eloy Duran wrote: >> Hello guys, >> >> While playing with making the tests work of (rails) >> ActiveSupport::MultiByte >> with String/NSString, I noticed the following problems. >> >> Not good, but not fatal: >> >> irb(main):001:0> "\270\236\010\210\245".to_nsstring >> => nil >> >> Very not good: >> >> irb(main):001:0> "\270\236\010\210\245".to_ns >> /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ >> ruby_addition.rb:70: [BUG] Bus Error >> ruby 1.8.6 (2007-06-07) [universal-darwin9.0] >> >> Abort trap >> >> >> I haven't had time yet to look into the problem.... >> >> Cheers, >> Eloy >>