This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ruby in practice question: Do UTF-8 and Ruby fit well in practice?

 
Dragan Stankovic
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you done any project using Ruby language that required UTF-8 support and do you think that Ruby lacks internationalization support?
 
Assaf Arkin
Author
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For internationalization, there are several libraries to choose from. The one I'm most familiar with is [url=http://github.com/mattetti/i18n]i18n[/url], which I use as part of Rails.
 
Jeremy McAnally
Author
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruby 1.9 includes some internationalization features, and Rails has recently added a LOT of great internationalization features.
 
Dragan Stankovic
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

My first project in ruby was simple site scraper using hpricot. Code sample that I tried to use seemed simple and straightforward. And then, because I tried to scrap a cyrillic site I run into problems which I couldn't solve. Xml parser started to throw errors, converting characters with iconv didn't work (or at least I couldn't make it work). So I gave up of doing this with ruby. I made that scraper in a matter of minutes using HtmlUnit (Java library)..

I'll give ruby another chance as soon as I have more time, but I was curious if the problem was with my lack of experience with ruby or (as I read at several forums) bad internationalization support in ruby. Anyway, as you pointed it out, it seems that they fixed the problems they had with earlier ruby versions so we'll see.
 
Assaf Arkin
Author
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might need to set $KCODE = 'U' in your script to tell Ruby to use UTF-8 by default.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic