I have been trying to use the gem 'character-encodings' which doesn't build in 1.9.2 however it does in 1.8.7 but even when I require 'encoding/character/utf-8' I still cant do the simplest of encoding.
require 'encoding/character/utf-8'
str = u"hëllö"
str.length
#=> 5
str.reverse.length
#=> 5
str[/ël/]
#=> "ël"
I get
ruby-1.8.7-p302 > # encoding: utf-8
ruby-1.8.7-p302 > require 'encoding/character/utf-8'
=> nil
ruby-1.8.7-p302 > str = u"hll"
=> u"hll"
ruby-1.8.7-p302 > str.length
=> 3
ruby-1.8.7-p302 > #=> 5
ruby-1.8.7-p302 > str.reverse.length
=> 3
ruby-1.8.7-p302 > #=> 5
ruby-1.8.7-p302 > str[/l/]
=> "l"
My question is, is there a really nice encoding library that can accept allot or possibly all the different characters out there. Or maybe use utf-16? I have tried the magic code "# encoding: utf-8" which didn't seem to do it either. Thank you