解决Ruby输出中文报错的问题 在.rb文件头加上# encoding: gbk,这一句用于确定编码方式 # encoding: gbk print "中国" 可正常输出“中国” Ruby2.0 默认是utf-8