From: Brian Candler Date: 2009-08-12T18:02:18+09:00 Subject: Re: 1.9 String and M17N documentation Eric Hodel wrote: > On Aug 7, 2009, at 00:52, Brian Candler wrote: >> Eric Hodel wrote: >>> I'm too lazy to dig this out of the archives, but there are some >>> encodings that don't have a 1:1 mapping to Unicode thus the round- >>> trip >>> through UTF-8 (etc.) will destroy them. >> >> Indeed, although we're both having a hard time thinking of an actual >> example. It seems that dealing with such things is not an everyday >> requirement for most people. > > This seems to be similar to the reasoning behind two-digit years. I don't understand what you're getting at. Obviously the round trip 4-digit-years -> 2-digit-years -> 4-digit-years is not lossless, but that would be a silly thing to do (i.e. if you've captured 4-digit-years, then you store them and work with them as 4-digit-years). You're saying you want to avoid external->Unicode->external encoding transcodings. But these are rarely problematic (I've still not seen an example), and in those rare cases you could just handle the external encoding as binary data. Remember also that for stateful encodings, you're forced to transcode anyway - even ruby 1.9 won't handle snippets of ISO_2022_JP in isolation, for example. >> So you write a library for that, and then the rest of us aren't >> saddled with the complexity. > > Unfortunately, software ends up getting used in places the author > didn't expect. Why not write robust software the first time instead > of being lazy? In My Opinion (which may not be shared by anyone else), ruby 1.9's String implementation is anything but robust. It's over-complicated, under-specified, buggy as hell, and badly gets in the way when you want to work with binary data or write programs which don't crash when given unexpected input. If it were optional, it would be fine. Since it's a mandatory part of the language, it destroys it for me. Ruby 1.8 is a fine general purpose language; ruby 1.9 is a text-processing language (and may still trip you up even in that case) Regards, Brian. -- Posted via http://www.ruby-forum.com/.