Home > front end >  Ruby pack problem
Ruby pack problem

Time:10-01

As follows:
 irb (main) : 072-0 & gt; [r]. "the other" pack (' m ') 
=> The "five yw25luw \ n
"The irb (main) : 073-0 & gt; "Five yw25luw \ n". Unpack (" m ")
=> [" \ xE5 \ x85 \ xB6 \ xE4 \ xBB \ x96 "]

The problem is why the unpack reduction is not back? \ xE5 \ x85 \ xB6 \ xE4 \ xBB \ x96 how can into Chinese characters?

CodePudding user response:

Looks like the UTF8 encoding

CodePudding user response:

 
2.3.1:050 & gt; "Five yw25luw \ n". Unpack (" m "). First. Encoding
=> # & lt; Encoding: ASCII - 8 bit & gt;

2.3.1:051 & gt; "Five yw25luw \ n". Unpack (" m "). First, force_encoding (" utf-8 ")
=> "Other"
  • Related