Convert Greek Unicode strings to "greeklish" in ruby

Friday, November 14, 2008
After digging around Ruby's Unicode handling (almost none, at least in 1.8) I found a way to transform Greek strings into the latin equivalents (also know as "greek-lish"). Here's a snippet which adds two methods on the String class: "greeklish" and the banged version "greeklish!". To use it you'll need RubyGems and ActiveSupport (if you have rails these are already included).

There it goes (you won't be able to see the code from your feedreader probably - sorry for that :/ ):


  • touche! you just saved me some time, thanx.

  • PanosJee

    you saved my time as well!

  • Ruby 1.9.2, παίρνω το εξής error.
    lib/main.rb:57:in `greeklish!': undefined method `length' for # (NoMethodError)

  • Post a Comment