TXT file create

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

TXT file create

Post by serge_girard »

Hello,

I need to create a TXT file as UTF-8.
Now I create standard ANSI, Edit the file in my editor and SAVE it as UTF-8.

Can I do this from within my PRG?

Thanks, Serge
There's nothing you can do that can't be done...
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: TXT file create

Post by edk »

Hallo, probeer het eens op deze manier.

Code: Select all

set( _SET_CODEPAGE, "PLWIN" )
cANSI := "Zażółć gęślą jaźń"		/* <- String Windows-1250 Encoded */

HB_MemoWrit( "Text file UTF-8 Encoded.txt", UTF8_BOM + hb_StrToUTF8( cANSI, "PLWIN") )  /* file UTF-8 Encoded with Byte Order Mark */
HB_MemoWrit( "Another Text file UTF-8 Encoded.txt",  hb_StrToUTF8( cANSI, "PLWIN") )  /* file UTF-8 Encoded without Byte Order Mark */
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: TXT file create

Post by serge_girard »

Thanks Edward,

I will take a look at it shortly !
My data comes from SQL database and contains French, Spanish and German languages (for the time being) and is put into a TXT file by my program.
The file with the UTF8_BOM is indeed saved as UTF8 but content is messed up: Fran�ois instead of François.
I need to same this was hardcoded in my program and the PRG is save as ANSI.
I will try with real data this week.

Thanks again!


Serge
There's nothing you can do that can't be done...
Post Reply