Hi, 2008/9/16 Marco <m / r.co>: > hi all. > > ruby 1.8.5 (2006-08-25) [i386-linux] > >>> puts 'hllo' > hllo > => nil >>> puts 'hllo'[0, 2] > h > => nil >>> puts 'hllo'[0, 3] > h > => nil >>> require 'iconv' > => true >>> puts 'hllo'[0, 3] > h > => nil >>> puts 'hllo'[0, 2] > h > => nil >>> > > > The character is probably 2 bytes long, so puts 'hllo'[1, 1] returns only > a "pice" of the character. Is there a way to make this work? > 'hllo'[0, 2] should return -> h > and > 'hllo'[0, 3] should return -> hl > > thanks > > You can do it using regular expression : 'hllo'.split(//u)[0, 2].to_s -> h Regards, Park Heesob