相关疑难解决方法(0)

在Delphi 7中进行字符串转换

我的应用程序是一个用Delphi 7编写的非unicode应用程序.

我想用这个函数将unicode字符串转换为ANSI:

function convertU(ws : widestring) : string;
begin
  result := string(ws);
end;
Run Code Online (Sandbox Code Playgroud)

我还使用此代码来设置要转换的正确代码页.

initialization
  SetThreadLocale(GetSystemDefaultLCID);
  GetFormatSettings;
Run Code Online (Sandbox Code Playgroud)

它在VCL主线程中工作得很好,但在TThread中却没有,在那里我得到一些问题标记'?' 作为函数convertU的结果.

为什么不在TThread?

delphi unicode localization ansi delphi-7

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

ansi ×1

delphi ×1

delphi-7 ×1

localization ×1

unicode ×1