Project1
标题:
路径编码问题
[打印本页]
作者:
wbsy8241
时间:
2012-11-23 19:35
标题:
路径编码问题
本帖最后由 wbsy8241 于 2012-11-24 19:47 编辑
#请放桌面测试
class String
M2W = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
W2M = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
def to_u
i = M2W.call(0, 0, self, -1, nil, 0)
buf = "\0" * i * 2
M2W.call(0, 0, self, -1, buf, i)
i = W2M.call(65001, 0, buf, -1, nil, 0, nil, nil)
ret = "\0" * i
W2M.call(65001, 0, buf, -1, ret, i, nil, nil)
return ret
end
def to_a
i = M2W.call(65001, 0 , self, -1,nil,0)
buf = "\0" * i * 2
M2W.call(65001, 0 , self, -1, buf, i)
i = W2M.call(0, 0, buf, -1, nil, 0, nil, nil)
ret = "\0" * i
W2M.call(0, 0, buf, -1, ret, i, nil, nil)
return ret
end
end
a = Dir.getwd
b = a.to_u
c = b.to_a
msgbox_p a
msgbox_p b
msgbox_p c
save_data(a, a)
复制代码
用古老的转码脚本转码后
save_data
load_data
还是不能支持中文路径
自己已通过非转码的方式 读取中文路径下文件了.
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1