Python中的Unicode在Delphi如何还原成Gb2312?
已知Python 中:
s = unicode("测试", "gb2312")
s = u'\u6d4b\u8bd5'
print s
测试
在Delphi里面如何将\u6d4b\u8bd5这样的还原成Gb2312的汉字呢?
找到个方法
function UniCode2GB(S : String):String;
Var
I: Integer;
begin
I := Length(S);
while I >=4 do
begin
try
Result :=WideChar(StrToInt('$'+S[I-3]+S[I-2]+S[I-1]+S[I]))+ Result;
except end;
I := I - 4;
end;
end;
相关问答:
python和pyqt以及Eric4都已经配置好了,打开Eric4写个python程序比如简单的
print“hello,world”,怎么编译运行了,Start菜单的所有命令都出现和图中差不多的对话框,应当怎么运行了?
求大家指教
没有人用 ......
之前我的电脑上安装了IronPython2.0,后安装ShareDevelop3.0,采用默认设置
我在ShareDevelop中建立了一个默认的Python的控制台或窗体项目,运行时报错如下:
调试器抛出异常System.IO.FileNotFoundException: ......