//替换系统自带的Utf8Decode函数,原函数遇到日文等非法字符不能解析
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;