Best practice to handle non-english characters in Ruby?

Posted by ragnarius on Stack Overflow See other posts from Stack Overflow or by ragnarius
Published on 2010-03-27T18:25:10Z Indexed on 2010/03/27 19:13 UTC
Read the original article Hit count: 321

Filed under:
|

My program file is encoded in UTF-8 so "abc".length == 3 but "åäö".length == 6. I realize that å, ä, ö, etc. are stored as two bytes in UTF-8, and that a Ruby String is a sequence of bytes (not characters), but it is annoying! Is there a best practice to work around this problem?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about character-encoding