"\xEF\xBD\x9E".encode("EUC-JP", "UTF-8")

“\xEF\xBD\x9E”.encode(“EUC-JP”, “UTF-8”) e$B$,e(B invalid byte
sequence e$B$K$J$j$^$9!#e(B

% ./ruby -ve ‘"\xEF\xBD\x9E".encode(“EUC-JP”, “UTF-8”)’
ruby 1.9.0 (2008-08-01 revision 18312) [i686-linux]
-e:1:in encode': invalid byte sequence (RuntimeError) from -e:1:in

“\xEF\xBD\x9E” e$B$Oe(B UTF-8 e$B$H$7$Fe(B (e$B0J2<$N$h$&$Ke(B)
[email protected]$7$$%(%s%3!<e(B
e$B%G%#%s%0$J$N$G!"e(Binvalid byte sequence
e$B$OJQ$G$O$J$$$G$7$g$&$+!#e(B

% ./ruby -ve ‘p “\xEF\xBD\x9E”.force_encoding(“UTF-8”).valid_encoding?’
ruby 1.9.0 (2008-08-01 revision 18312) [i686-linux]
true

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs