StrConv(Block, vbUnicode),Frequently prompts memory overflow for no reason。
ByteToUnicodeStr Under normal circumstances, it will run 30-50% faster than StrConv (Block, vbUnicode)
how to call by api?
ByteToUnicodeStr = Left$(ByteToUnicodeStr, lngResult)
This sentence will also cause :String space overflow
Classic VB - Does Visual Basic 6 support Unicode?-VBForums
https://www.vbforums.com/showthread....upport-Unicode
Reading and Writing UTF-16 and UTF-8 Files-VBForums
https://www.vbforums.com/showthread....nd-UTF-8-Files
ByteToUnicodeStr Under normal circumstances, it will run 30-50% faster than StrConv (Block, vbUnicode)
how to call by api?
ByteToUnicodeStr = Left$(ByteToUnicodeStr, lngResult)
This sentence will also cause :String space overflow
Code:
Public Function ByteToUnicodeStr(lPtr As Long) As String 'good,快44%
Dim lngUtf8Size As Long, lngResult As Long
lngUtf8Size = lstrlenA(lPtr)
' ByteToUnicodeStr = StringHelpers.SysAllocStringLen(ByVal 0&, lngUtf8Size) ' '47.65%
ByteToUnicodeStr =string(lngUtf8Size," ")
lngResult = MultiByteToWideChar(GetACP, 0, lPtr, lngUtf8Size _
, StrPtr(ByteToUnicodeStr), lngUtf8Size)
ByteToUnicodeStr = Left$(ByteToUnicodeStr, lngResult)
End Function
Classic VB - Does Visual Basic 6 support Unicode?-VBForums
https://www.vbforums.com/showthread....upport-Unicode
Reading and Writing UTF-16 and UTF-8 Files-VBForums
https://www.vbforums.com/showthread....nd-UTF-8-Files