Hello,
I need to upload some data from a text-file (saved as UTF-8) containing: ë, ç, à, á, â,ã,ä,å,æ,ç,è.. etc...
Reading this file and displaying the content in another file is no problem, but displaying on screen gives
something like this: Préporché instead of Préporché.
So my input file contains "Préporché", writing to new file is OK but displaying on the screen is not.
How to fix this problem?
Serge
reading/displaying UTF-8 TXT file
Moderator: Rathinagiri
- serge_girard
- Posts: 3309
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
reading/displaying UTF-8 TXT file
There's nothing you can do that can't be done...
Re: reading/displaying UTF-8 TXT file
Hola Serge:
Hace tiempo tuve el problema al revés, mi archivo de texto generaba caracteres extraños al guardar. Lo solucione con ayuda de este foro donde recurrí al juego de caracteres que puedes configurar en cada programa que generas.
REQUEST HB_CODEPAGE_ESWIN
HB_SETCODEPAGE("ESWIN")
REQUEST HB_LANG_ES
HB_LANGSELECT( "ES" )
SET LANGUAGE TO SPANISH
Por el error que mencionas, me parece que el problema esta con la configuración de idiomas del sistema operativo que ejecutas, talvez si revisas la configuración regional y de idiomas de Windows podrías solucionarlo.
Hace tiempo tuve el problema al revés, mi archivo de texto generaba caracteres extraños al guardar. Lo solucione con ayuda de este foro donde recurrí al juego de caracteres que puedes configurar en cada programa que generas.
REQUEST HB_CODEPAGE_ESWIN
HB_SETCODEPAGE("ESWIN")
REQUEST HB_LANG_ES
HB_LANGSELECT( "ES" )
SET LANGUAGE TO SPANISH
Por el error que mencionas, me parece que el problema esta con la configuración de idiomas del sistema operativo que ejecutas, talvez si revisas la configuración regional y de idiomas de Windows podrías solucionarlo.
- serge_girard
- Posts: 3309
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: reading/displaying UTF-8 TXT file
Hi SvargasD,
Thanks, but it doesn't work....
Serge
Thanks, but it doesn't work....
Serge
There's nothing you can do that can't be done...
Re: reading/displaying UTF-8 TXT file
Hi,
I have just that drawback and it actually has to do with the OS codepage and even the codepage of the editor with which you write your code.
When the problem is just as you mentioned about displaying on the screen, I personally solve it with hb_Utf8ToStr, since my code editor is set to UTF-8 and my Windows codepage is different.
Hope it helps you.
Regards,
Javier
I have just that drawback and it actually has to do with the OS codepage and even the codepage of the editor with which you write your code.
When the problem is just as you mentioned about displaying on the screen, I personally solve it with hb_Utf8ToStr, since my code editor is set to UTF-8 and my Windows codepage is different.
Hope it helps you.
Regards,
Javier
- serge_girard
- Posts: 3309
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: reading/displaying UTF-8 TXT file
Javier,
Thanks this has brought me to the solution:
Thanks again !
Serge
Thanks this has brought me to the solution:
Code: Select all
REQUEST HB_CODEPAGE_FRWIN
hb_setcodepage("FRWIN")
//then:
IF hb_StrIsUTF8(cSTR)
cSTR := hb_utf8tostr(cSTR, 'FRWIN')
ENDIF
// this is the correct translation !!
Serge
There's nothing you can do that can't be done...