0

I am modifying a program that create a positional flat EDI file from a cvs. The input file use UTF-8 as the output must use.

I am facing a problem that writing an UTF-8 string with this code:

Public Function WriteFileBinArray(sString() As Byte, iChannel As Integer) As Boolean

    Const kbytCarriageReturn        As Byte = 13
    Const kbytNewLine               As Byte = 10

    WriteFileBinArray= False
    NumberError = 0
    sErrore = ""

    Put #iChannel, , sString()
    Put #iChannel, , kbytCarriageReturn
    Put #iChannel, , kbytNewLine

    WriteFileBinArray= True

End Function

The output string, will not have the expected lenght. So the positional flat file will be wrong. As you know better than me, every UTF-8 char is composed by two bytes. I suppose that the problem fall here.

How can i solve my porblem?

Angelo Badellino
  • 2,141
  • 2
  • 24
  • 45

1 Answers1

0

You state the problem is The output string, will not have the expected lenght

I would have thought it was a matter of padding the output string to be the expected length. By copying the data into another array of the required length and padding it with spaces or null characters so it matches the expected length.

Bigtoe
  • 3,372
  • 1
  • 31
  • 47