From: Intransition Date: 2010-09-01T03:17:45+09:00 Subject: Re: Ok, so no $KCODE --a chance to learn a little about Encodings On Aug 31, 12:47 pm, Intransition wrote: > I am working on some 1.8  to 1.9 compatibility. I have a bit of code: > >     if $KCODE =~ /^U/i >       unpack_rule = 'U*' >     else >       unpack_rule = 'C*' >     end > > $KCODE is no long effective, so what to do for 1.9? I think I have figured it out. Given two strings to compare we can do: if str2.encoding != str1.encoding str2 = str2.encode(str1.encoding.name) end s = str1.codepoints.to_a t = str2.codepoints.to_a Where #codepoints does the same as old str.unpack(unpack_rule). This page was very helpful: http://blog.grayproductions.net/articles/ruby_19s_string