From: Jeremy Woertink Date: 2008-11-22T02:06:27+09:00 Subject: Re: Weird conversion in IRB wow, that's so weird, but it worked! Thanks man. ~Jeremy Brian Candler wrote: > Jeremy Woertink wrote: >> ok, I've been reading more on it. I guess it's like unicode or >> something.... > > Yep, you can even see the string broken into unicode chars: > > irb(main):009:0> src.scan(/./u) > => ["W", "H", "E", "N", "\302\240", "N", "O", "N", "E", "M", "P", "T", > "Y", "\302\240", "@", "h", "o", "r", "i", "z", "o", "n", "t", "a", "l", > "-", "f", "e", "a", "t", "u", "r", "e", "d", "-", "i", "t", "e", "m", > "-", "t", "e", "x", "t", "2"] > >> and I want to split it by the \302\240, just doing >> >> string.split('\302\240') doesn't work. > > You need double-quotes, not single-quotes, for the \nnn syntax to be > turned into single bytes. > > irb(main):011:0> src.split("\302\240") > => ["WHEN", "NONEMPTY", "@horizontal-featured-item-text2\n"] -- Posted via http://www.ruby-forum.com/.