I need to read a unicode file created by PB, like:
Code: Select all
OpenFile(0,"test.txt", #PB_Unicode)
WriteByte(0,255) ; signature
WriteByte(0,254) ; signature
WriteStringN(0,"ABCDEF", #PB_Unicode)
WriteStringN(0,"XYZTUV", #PB_Unicode)
WriteStringN(0,"KLMNOPQ", #PB_Unicode)
WriteStringN(0,"0123456", #PB_Unicode)
WriteStringN(0,"789", #PB_Unicode)
WriteStringN(0,"GHIJKL", #PB_Unicode)
CloseFile(0)
Code: Select all
Procedure ReadCallback(Status, Filename$, File, Size)
If Status = #PB_Status_Loaded
Debug "File: " + Filename$ + " - Size: " + Size + " bytes"
While Not Eof(0)
Debug Str(NbLine) + ":"+ReadString(0,#PB_Unicode)+"*"
NbLine+1
If NbLine > 20
Break
EndIf
Wend
CloseFile(0)
ElseIf Status = #PB_Status_Error
Debug "Error when loading the file: " + Filename$
EndIf
EndProcedure
OpenFile(0, "test.txt", @ReadCallback(), #PB_Unicode)
After investigation, I noticed that the line'termination in PB is: 0D 00 0A 00, but in SB it's: 0A 00
if I removed manually (with a hex editor) the extra 0D 00, the file is read correctly.
is this a bug?
Thanks in advance