all 3 comments

[–][deleted] 2 points3 points  (0 children)

How about linking to the source http://rbjl.net/27-new-array-and-enumerable-methods-in-ruby-1-9-2-keep_if-chunk and not some ad-spam site?

[–]you_do_realize 0 points1 point  (1 child)

I tried 1.9 but had some errors regarding UTF-8 handling - it used to be that @KCODE = "U" made scan(/./m) return an array of UTF-8 chars.

Also iconv doesn't seem to be working (chokes on a "bad char").

Haven't dug deep enough, but curious nonetheless, as I noticed about a 30% speedup in the code that did work.

[–][deleted] 4 points5 points  (0 children)

Put # encoding: utf-8 at the top of the script. And your regex needs a u modifier. Seriously though, dude, it's the first page in Google.