From: Martin Duerst Date: 2007-09-30T16:06:18+09:00 Subject: Re: String.force_encoding At 13:44 07/09/30, Gary Wright wrote: >In my quick look at the source it seems that > > str.encoding > >returns the current encoding of str. So my own POLS would suggest > > str.encoding = "binary" > >to change the encoding. It just seems completely non-Ruby-like >to have: > > str.force_encoding("binary") As said already, there will most probably be a shorter method name (maybe as short as 'as') for moving to and from "binary". The problem with encoding= is that in general, it has two interpretations: "change the bytes, keep the characters (or raise an exception)", and "change the characters (or create garbage), keep the bytes". I'm very sure that what looks like POLS to some will be surprising to others. I'm also very sure that there will be some for whom both views sometimes look like POLS, depending on what they assume feels natural at the moment. Overall, that suggests that it is better to have two clearly different methods, each different from the encoding query method. Regards, Martin. #-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University #-#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp