關於中文問題
php?name=Ruby" onclick="tagshow(event)" class="t_tag">Ruby好像不支持中文
例如:Dir.mkdir('中文',0) 失敗!
甚至 puts "大家好" 也不行
無法使用中文目錄
到底是不是這樣呀?
我是用netbeans寫的,輸出的是亂碼,建立了一個亂碼目錄。
def walk_dir(path_str)
path = Pathname.new(path_str)
path.children.each do |entry|
if entry.directory?
walk_dir(entry) {|x| yield(x)}
elsif entry.file?
yield entry
end
end
end
這段代碼對中文目錄不起作用。
$kcode="u" 也不行,我看書上說,這個選項是為日文準備的呀
require 'iconv'
class Dir
def self.mkdirgbk(name)
Dir.mkdir Iconv.conv('Big5','utf-8',name)
end
end
Dir.mkdirgbk("D:/中文目錄")
依然是亂碼
知道问题了,是Netbeans的问题
[ 本帖最后由 bj0_0 于 2008-4-16 14:49 编辑 ]