From: "Martin J. Dürst" Date: 2009-06-26T18:33:07+09:00 Subject: [ruby-core:24044] Re: [Bug #1681] Integer#chr Should Infer Encoding of Given Codepoint We have String#encode (without any arguments), which transcodes to default_internal (and in addition, doesn't raise an exception for invalid byte sequences,..., which may be a security issue), so I don't think using Integer#chr with a default encoding of default_internal would be such a big problem. Regards, Martin. On 2009/06/25 18:06, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:24001] Re: [Bug #1681] Integer#chr Should Infer Encoding of Given Codepoint" > on Wed, 24 Jun 2009 09:54:06 +0900, Run Paint Run Run writes: > | > |>> This seems needlessly verbose given that Ruby already knows > |>> that my source encoding is UTF-8. > |> > |> It's irrelevant to source encoding. A possiblity would be > |> Encoding.default_internal? > | > |Indeed; my mistake. :-) > > Source encoding may be different from default internal encoding. > Since codepoint _number_ does not contain any encoding information, > there's information loss. I am not sure it is OK to use possibly > wrong encoding information (default internal), even as a default. > > I'd like to hear opinion from others. > > matz. > > -- #-# Martin J. D�rst, Professor, Aoyama Gakuin University #-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp