'宽字符 换成 UTF8字符
'宽字符是指针，返回包含UTF8字符格式的普通字符串
'WStrLen 是宽字符个数，不是字节长度
Function wStrToUtf8(WStrPtr as WString Ptr, WStrLen as UInteger=0) as  String
'WStrLen 是宽字符个数，不是字节长度
    Dim UTF8Mem as  ZString Ptr
    Dim ss as String  
    if WStrLen=0 then WStrLen=Len(*WStrPtr)
    If WStrPtr>0 And WStrLen>0 Then
        ss=String(WStrLen*3,0)
        UTF8Mem=StrPtr(ss)    
        Dim UTF8Len as Integer =WideCharToMultiByte(CP_UTF8, 0, WStrPtr, WStrLen, UTF8Mem, Len(ss), Null, Null)
        If UTF8Len Then Function=Left(ss,UTF8Len)
    EndIf
End Function