D10下:
function ToUTF8Encodes(str: UTF8String): string;
var
b: Byte;
begin
for b in BytesOf(str) do
Result := Format('%s%%%.2x', [Result, b]);
end;
调用:
procedure TForm1.btn13Click(Sender: TObject);
begin
ShowMessage(ToUTF8Encodes('中国'));
end;<

在 Delphi 10 下,如何将中文字符串转换为 UTF-8 编码,并提供了相应的函数调用示例,以及从 UTF-8 转回中文的方法。
最低0.47元/天 解锁文章
815

被折叠的 条评论
为什么被折叠?



