84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
Ruby散列中保存中文,使用puts输出时只能显示unicode码,请问如何显示中文?
源码:
hash={a:"第一条",b:"第二条",c:"第三条"} puts hash
输出结果:
{:a=>"\u7B2C\u4E00\u6761", :b=>"\u7B2C\u4E8C\u6761", :c=>"\u7B2C\u4E09\u6761"}
人生最曼妙的风景,竟是内心的淡定与从容!
Open irb input
Encoding.locale_charmap
Check if your encoding is => "UTF-8"
The Ruby version must be greater than 1.8
Check whether you have readline installed
Warning: Trying to solve a non-existent problem.
I tested it on CentOS and Mac and didn’t find the problem you mentioned.
Open irb input
Encoding.locale_charmap
Check if your encoding is => "UTF-8"
The Ruby version must be greater than 1.8
Check whether you have readline installed
Warning: Trying to solve a non-existent problem.
I tested it on CentOS and Mac and didn’t find the problem you mentioned.