From: Robert Klemme Date: 2009-05-03T19:55:08+09:00 Subject: Re: String problem On 03.05.2009 11:26, Tom Cloyd wrote: > Fresh Mix wrote: >> What wrong? >> >> # irb >> irb(main):001:0> xxx = "лошадь" >> => "\320\273\320\276\321\210\320\260\320\264\321\214" >> irb(main):002:0> xxx.length >> => 12 >> > I assume you're wondering why each character appears to be represented > by two bytes - and I believe it's because the encoding is, of necessity, > UTF-8 or something very similar. If I recall correctly, this encoding is > designed to be able to represent the world's alphabets, etc., rather > than merely the limited character set used in western European > languages, and so two bytes must be used to allow for all the possibilities. > > If I don't have this quite right (or right at all), I'm sure I'll be set > right by those who know more here (and they are legion!). Actually I do not call myself in when it comes to encodings in Ruby. But I believe there is one important bit of information missing that's needed to properly answer the OP's question: what Ruby version did you use? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/