ActiveSupport::Multibyte question || Rails console question

Hello guys,

I just saw this video: ActiveSupport::MultiByte And was trying to reproduce the example in there. I got Edge Rails (rev5229).

So what I did was this (the comments are the output from the console): $KCODE = 'u' # => 'u' c = 'Café is a nice word' # => "Caf\202 is a nice word" puts c.reverse # drow ecin a si éfaC

As you can see these results are quite different from what appears on the video. Furthermore if I type this: puts c.chars.reverse # drow ecin a si ôÇÜfaC

And what's even worse, it even modified my string and now my c object is messed up, if I type this: c # I get this: CafôÇÜ is a nice word

It modified my string! Anyone has any ideas why this could be happening?

About the rails console:

Woops, forgot to mention that I got a keyboard for the spanish language (you know, those with the "ñ" key, and others).


I guess the question is right. What you need in this case is a UTF-8 roundtrip, that is

export LANG=en_US.UTF-8

Too bad, I'm in a windows box =(

Any tips to solve my problem? (besides switching to Linux!).