Frederick Cheung wrote in post #968521: > On Dec 14, 4:22pm, Bob Mundane <li...@ruby-forum.com> wrote: >> Hello, with Rails 3.0.3 >> >> "Caf Noir ".strip => "Caf noir" >> but >> "Caf ".strip => "Caf\303\251" > > While it may not look pretty this is accurate if you are using utf8 - > is 0xC3 0xA9 in UTF8, which is 0o303 0o251 in octal. I'm not sure > why inspect is choosing to show the octal escape codes but you string > does contain the correct bytes. (maybe some heuristic that tries to > determine whether the string is utf8 and show be displayed as such or > whether it just contains random binary gunk) > > Fred
I tried in 3 different versions of ruby and the way it is rendered in irb is indeed different (and is confusing): ruby-1.8.7-p302 > "Caf\303\251" => "Caf\303\251" ... ree-1.8.7-2010.02 > "Caf\303\251" => "Caf\303\251" ... ruby-1.9.2-head > "Caf\303\251" => "Café" @Bob, are you sure you use UTF-8 encoding for your web page? HTH, Peter -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.