Writing ANSI string to Unicode file over FTP

前端 未结 1 1991
无人及你
无人及你 2021-01-21 07:48

I have the following Visual Basic 6.0 function which writes an ANSI string to a new file over FTP. I would like it to write the file as UTF-16LE. Is there any good way to do tha

相关标签:
1条回答
  • 2021-01-21 08:38

    We need to see the declaration for apiInternetWriteFile. I'm pretty sure it's a Declare into an API call, maybe something in WinINet.dll. My guess is that you need to:

    • Change the Declare so it expects a ByVal Long for the 2nd argument
    • EDIT to get a BOM at the start, try Contents = ChrW(&HFEFF&) & Contents. Or possibly FFEF, not sure of the endianness.
    • Pass StrPtr(contents) for the 2nd argument
    • Pass Len(contents)*2 for the 3rd argument (length in bytes)

    That will pass a Unicode UTF-16 string as the contents argument

    0 讨论(0)
提交回复
热议问题