Solve a Tricky Ruby Problem and Win a Prize!

Hello everyone,

You know that annoying feeling when you have crutches in your code and can’t seem to find a better solution, don’t you? Well, this is it. We faced a tricky Ruby problem: UTF-8 regular expressions fail when working with non UTF-8 strings. We’ve tried to solve it and improve this chunk of code, but to no avail. We were really stumped. And then we realized this problem could be a good task for a Ruby contest!

So, we’ve prepared the github project with the simple method:

and the test that now fails:

The task is to change the method so the test passes. Do you have any idea how this can be done?

Friday is always a good day to escape from everyday routine and code for your own pleasure. Rise up to the challenge and enter the contest! Just make the test pass and send your pull request before August 10. We have already prepared a nice prize for the best solution:

prize

Learn more on our special webpage or watch this short demo with the instructions.


Have a happy friday!
JetBrains RubyMine Team

This entry was posted in Announcement, Screencast. Bookmark the permalink.

One Response to Solve a Tricky Ruby Problem and Win a Prize!

  1. Stefan says:

    Not a ruby developer, but I suspect the regex library, maybe using the Oniguruma regexp engine with the /u flag to treat the string as utf8.

    An other dirty trick would be to force convert it to utf8 before runing the regex on

    (.force_encoding("utf-8"))

Leave a Reply

Your email address will not be published. Required fields are marked *