|
| Inicio → WINDEV 2024 → How to convert a txt (or csv) file from UTF-8 to UCS-2 Little Endian |
| How to convert a txt (or csv) file from UTF-8 to UCS-2 Little Endian |
| Iniciado por Andrea VENTURA, 24,jul. 2018 13:28 - 2 respuestas |
| |
| | | |
|
| |
Miembro registrado 4 mensajes |
|
| Publicado el 24,julio 2018 - 13:28 |
Hello, I produce a text file in csv format. How to convert it to UCS-2 Little Endian encode?
Can this function help me BufferToHexa? How to use it? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 24,julio 2018 - 15:21 |
Hi Andrea
try with ANSItoUNICODE
best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
On 7/24/2018 5:28 AM, Andrea VENTURA wrote:
Hello, I produce a text file in csv format. How to convert it to UCS-2 Little Endian encode?
Can this function help me BufferToHexa? How to use it? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 4 mensajes |
|
| Publicado el 25,julio 2018 - 13:35 |
Hello Fabrice, thanks for the answer, but the file is already UTF-8 (not ANSI). However I solved.
What I have to do: is to convert UTF-8 w/o BOM file (the one Windev creates with fWrite function in an old file UCS-2 Little Endian (the same Ms Excel save as Text file). This UCS-2 file is compatible with old machine and if the file contains TAB character Excel open it as Table correctly
I opened a UCS-2 file with Hexadecimal editor. The USC-2 is the same of UTF-8, but at the beginning there's "FF FE" Hexa block and at the end of every character there's "00" Hexa block.
How I did (for other with same issue):
I open an imput file test.tmp and I write it converted as test.txt
ResCreation1 is int BufferRead is Buffer BufferWrite is Buffer = "FFFE" counter is int = 1
BufferRead = fLoadBuffer("C:\Users\user\Desktop\test.tmp") Info(Length(BufferRead))
ResCreation1 = fCreate("C:\Users\user\Desktop\test.txt")
BufferWrite=HexaToBuffer(BufferWrite) fAddBuffer("C:\Users\user\Desktop\test.txt",BufferWrite)
FOR counter = 1 TO Length(BufferRead) BufferWrite=BufferToHexa(BufferRead[[counter]]) BufferWrite=HexaToBuffer(BufferWrite) fAddBuffer("C:\Users\user\Desktop\test.txt",BufferWrite) BufferWrite="00" BufferWrite=HexaToBuffer(BufferWrite) fAddBuffer("C:\Users\user\Desktop\test.txt",BufferWrite) END |
| |
| |
| | | |
|
| | | | |
| | |
|