Skip to content

Instantly share code, notes, and snippets.

@coldnebo
Created August 31, 2011 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coldnebo/1184533 to your computer and use it in GitHub Desktop.
Save coldnebo/1184533 to your computer and use it in GitHub Desktop.
[FIXED] ruby encodings... can we word this error differently?
$ irb
ruby-1.9.2-p180 :001 > "“"
=> "“"
ruby-1.9.2-p180 :002 > "“".encoding
=> #<Encoding:UTF-8>
ruby-1.9.2-p180 :003 > "\“"
SyntaxError: (irb):7: invalid multibyte char (UTF-8)
(irb):7: invalid multibyte char (UTF-8)
from /local/rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
@coldnebo
Copy link
Author

coldnebo commented Jan 6, 2012

Just checked it in irb... it's fixed in Ruby at least:

ruby-1.9.3-p0 :001 > "“"
 => "“" 
ruby-1.9.3-p0 :002 > "“".encoding
 => #<Encoding:UTF-8> 
ruby-1.9.3-p0 :003 > "\“"
 => "“" 

What do you get if you use irb as above?

@nagarajpg
Copy link

nagarajpg commented Jan 7, 2012 via email

@coldnebo
Copy link
Author

coldnebo commented Jan 9, 2012

Hi Nagaraj, your irb session shows that the underlying problem with escaped UTF-8 has been fixed as I originally reported it. The higher level error you are seeing "Error during failsafe" is a rack or Rails error in your application and likely has a different root cause.

@VenkatesanPrabhu
Copy link

Good one..Clear explanation..Thanks to the author..
i've wrote an article on the RUBY INVALID MULTI BYTE!
http://www.wikitechy.com/fix-error/ruby-invalid-multi-byte-character
Please visit :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment