设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2548|回复: 0
打印 上一主题 下一主题

[已经解决] 路径编码问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1281 小时
注册时间
2006-8-27
帖子
590
跳转到指定楼层
1
发表于 2012-11-23 19:35:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 wbsy8241 于 2012-11-24 19:47 编辑
  1. #请放桌面测试
  2. class String
  3.   M2W = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  4.   W2M = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  5.   def to_u
  6.     i = M2W.call(0, 0, self, -1, nil, 0)
  7.     buf = "\0" * i * 2
  8.     M2W.call(0, 0, self, -1, buf, i)
  9.     i = W2M.call(65001, 0, buf, -1, nil, 0, nil, nil)
  10.     ret = "\0" * i
  11.     W2M.call(65001, 0, buf, -1, ret, i, nil, nil)
  12.     return ret
  13.   end
  14.   def to_a
  15.     i = M2W.call(65001, 0 , self, -1,nil,0)
  16.     buf = "\0" * i * 2
  17.     M2W.call(65001, 0 , self, -1, buf, i)
  18.     i = W2M.call(0, 0, buf, -1, nil, 0, nil, nil)
  19.     ret = "\0" * i
  20.     W2M.call(0, 0, buf, -1, ret, i, nil, nil)
  21.     return ret
  22.   end
  23. end

  24. a = Dir.getwd
  25. b = a.to_u
  26. c = b.to_a
  27. msgbox_p a
  28. msgbox_p b
  29. msgbox_p c
  30. save_data(a, a)
复制代码
用古老的转码脚本转码后
save_data
load_data
还是不能支持中文路径



自己已通过非转码的方式 读取中文路径下文件了.
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 17:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表