From: Patrick Okui Date: 2009-09-02T18:18:57+09:00 Subject: Re: how to convert string to binary and back in Ruby 1.9? On Sep 2, 2009, at 2:55 AM, Joe wrote: > On Sep 1, 4:18 pm, Iñaki Baz Castillo wrote: >> El Miércoles, 2 de Septiembre de 2009, Joe escribió: > >> In the other way, #encode does change the encoding, and it fails if >> the >> conversion is not possible. >> >> -- >> Iñaki Baz Castillo > > OK, so String#force_encoding just changes the encoding, but does not > alter the string. But how does it decide to print as the same > sequence of Cyrillic characters, when it thinks its encoding is > ISO-8859-1? How does ruby1.9 decide what characters to display when > printing a String? Surely it must adhere to the encoding of that > String? Is ruby storing the ISO-8859-1 encoded string as a sequence > of unicode characters, or what? Brian Candler did a pretty thorough documentation of 1.9's M17N at http://github.com/candlerb/string19 . There are also multiple sources of documentation on the subject at http://blog.grayproductions.net/articles/what_ruby_19_gives_us (Edward Gray) and elsewhere. I'm also more comfortable with how 1.8 behaves but then again I'm a newbie here. Patrick