p.matsinopoulos
p.matsinopoulos

Reputation: 7810

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?

Upvotes: 6

Views: 1103

Answers (1)

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

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 "Δ" #=> "δ"

Upvotes: 3

Related Questions