Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Print Unicode to a file

I’m using the simple code below to print a string to a file. It is working fine except when the string contains extended Unicode characters. In that case those characters are all converted to U+FFFD. Examination of the string just before printing to the file shows the correct Unicode values. How can I setup my file output to preserve the extended Unicode characters?

    Dim fileHandle As Integer
    Dim FileWriteGPX As String  ‘output file name
    Dim strGPX As String  ‘data assembled for output

' Write strGPX to file
    fileHandle = FreeFile
    Open  ConvertToUrl(FileWriteGPX) For Output As #fileHandle
    Print #fileHandle, strGPX
    Close #fileHandle