新手问题 Ruby 字符串编码问题

rhettor · February 17, 2017 · Last by rhettor replied at February 17, 2017 · 916 hits

从文件读取部分数据会存在�:"顾灿�?",再通过String#chomp后数据就变成 顾灿龙]]></value></variable><variable name="o" kind="local" type="String" hasChildren="true" objectId="+0x1723854"><value><![CDATA[顾灿龙]]></value></variable><variable name="speakers" compactValue="{}" kind="local" type="Hash" hasChildren="false" objectId="+0x17e5744"><value><![CDATA[Empty Hash" 但是通过 puts 出的又是正确的数据!请问这是怎么一回事?

文件读取部分数据会存在�:"顾灿�?" ,估计是文件编码格式问题。

#1 楼 @sec 是 utf-8 呀,而且用 win32ole 读取 excel 也会出现这个现象

You need to Sign in before reply, if you don't have an account, please Sign up first.