Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make Ruby 1.8 downcase non-latin characters?

I am using Ruby 1.8. It seems that downcase does not alter non-latin characters. For example:

"Δ".downcase

returns "Δ"

I know that in Ruby 1.9.1 and later, I can use Unicode Utils (from here). I have tried it and it works ok. Returns "δ" for the previous example.

Is there an equivalent (or any) solution for 1.8 Ruby?

like image 833
p.matsinopoulos Avatar asked Jul 11 '11 14:07

p.matsinopoulos


1 Answers

nash@nash:~$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux]

gem install unicode (https://rubygems.org/gems/unicode)

require 'unicode'

$KCODE = 'u'
p Unicode::downcase "Δ" #=> "δ"
like image 191
Vasiliy Ermolovich Avatar answered Oct 17 '22 05:10

Vasiliy Ermolovich