delphi DecodeUtf8Str解决系统自带UTF8解码缺陷


本文整理自网络,侵删。

 

//delphi DecodeUtf8Str解决系统自带UTF8解码缺陷

 function DecodeUtf8Str(const S: UTF8String): WideString;
 var lenSrc, lenDst  : Integer;
 begin
   lenSrc  := Length(S);
   if(lenSrc=0)then Exit;
   lenDst  := MultiByteToWideChar(CP_UTF8, 0, Pointer(S), lenSrc, nil, 0);
   SetLength(Result, lenDst);
   MultiByteToWideChar(CP_UTF8, 0, Pointer(S), lenSrc, Pointer(Result), lenDst);
 end;


//因为Delphi自带的转换函数遇到其无法识别的字符串就返回空,以上函数可解决该问题。

相关阅读 >>

Delphi dectobinstr

Delphi Delphi写的一个上位机

Delphi 将string 转为 array of ansichar

Delphi idftp连不上ftp服务器的解决方法

Delphi 字符串查找替换函数

16 位浮点运行 pascal/Delphi

Delphi中转向语句break,continue,exit的作用

Delphi d10.x 并行库ppl编程之ttask

Delphi tpath

Delphi关于延迟时间的一点智慧

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...