STATUS = { "0" => "通过", "1" => "拒绝" }
?
上面这段代码,在ruby1.8.7下运行正常,但在ruby1.9.2下却报出以下错误:
invalid multibyte char (US-ASCII) syntax error, unexpected $end, expecting '}' "0" => "通过", ^):
只要在文件开头加上以下代码即可:
# encoding: utf-8 或者 # coding: utf-8