From: 7stud -- Date: 2009-05-03T20:21:48+09:00 Subject: Re: String problem Fresh Mix wrote: > > # 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 > > What wrong? In 1.8.* versions, ruby doesn't recognize unicode, where characters are represented by multiple bytes. ruby thinks everything in an ascii character where characters are represented by one byte. Try this: xxx = "лошадь" puts xxx.length --output:-- 12 $KCODE = "u" require 'jcode' puts xxx.jlength --output:-- 6 xxx.each_char do |u| puts u end --output:-- л о ш а д ь -- Posted via http://www.ruby-forum.com/.