"\x80".force_encoding("utf-8").encode("utf-32be",:invalid=>:replace)

“\x80”.force_encoding(“utf-8”).encode(“utf-32be”,:invalid=>:replace)
e$B$H$9$k$H!"e(B
“\x00” e$B$K$J$j$^$9!#e(B

% ./ruby -ve ’
s = “\x80”.force_encoding(“utf-8”).encode(“utf-32be”,:invalid=>:replace)
p s.force_encoding(“ascii-8bit”)

ruby 1.9.0 (2008-07-31 revision 18295) [i686-linux]
“\x00”

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