| 赞 | 0  | 
 
| VIP | 13 | 
 
| 好人卡 | 65 | 
 
| 积分 | 1 | 
 
| 经验 | 58644 | 
 
| 最后登录 | 2017-10-23 | 
 
| 在线时间 | 1281 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 1281 小时
 
        - 注册时间
 - 2006-8-27
 
        - 帖子
 - 590
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 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 
还是不能支持中文路径 
 
 
 
自己已通过非转码的方式 读取中文路径下文件了. |   
 
 
 
 |