Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

Ruby gets a new (and good!) UTF-8 library

By Peter Cooper / July 25, 2006

_why announces a release of a new UTF-8 library (which adds UTF-8 support to Ruby, without using KCODE) by Nikolai Weibull. _why has also packaged it up (unofficially) into a gem to make it even easier to install (not all of us use git). Here's some demonstration code:

require 'encoding/character/utf-8'
str = u"hëllö"
str.length
  #=> 5
str.reverse.length
  #=> 5
str[/ël/]
  #=> "ël"

Other Posts to Enjoy

Twitter Mentions