FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour UTF-8 con BOM
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
UTF-8 con BOM
Posted: Sun Mar 30, 2025 08:38 PM
is there a command or function that can convert all special characters such as "à" or "n°" because when I put it in an html file I see strange symbols, it would take a command like UTF-8 with BOM

on my html I allready insert
 TEXT INTO cHtml
      <!DOCTYPE html>
      <html lang="it">
      <head>
         <meta charset="UTF-8">
but it's not enough

because I have a string as "contabilità" with a grave or "Ordine n°" and on html I see a symbol ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: UTF-8 con BOM
Posted: Mon Mar 31, 2025 12:16 AM

You editor is configured for UTF8?

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la nociĂłn del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: UTF-8 con BOM
Posted: Mon Mar 31, 2025 08:16 PM

I use xmate

But the problem Is on a menu "contabilitĂ " i change With che(224) and on the HTML i make a converion. Strtran With agrave;

Now seems tò run ok

For the oders "orders n°' i saw i can change because It Is my script and the Number of invoice come from dbf , i must only make some test

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 244
Joined: Mon Jun 05, 2006 09:39 PM
Re: UTF-8 con BOM
Posted: Mon Mar 31, 2025 10:12 PM
Try this
 TEXT INTO cHtml
_CodeUtf8Bom_
      <!DOCTYPE html>
      <html lang="it">
      <head>
         <meta charset="UTF-8">
ENDTEXT

cHtml := Strtran(cHtml,_CodeUtf8Bom_,chr(239)+chr(187)+chr(191))
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: UTF-8 con BOM
Posted: Thu Apr 03, 2025 07:19 AM
´
Giovany Vecchi wrote: cHtml := Strtran(cHtml,_CodeUtf8Bom_,chr(239)+chr(187)+chr(191))
Error occurred at: 04/03/25, 09:18:56
Error description: Error BASE/1003 Variable does not exist: _CODEUTF8BOM_

Stack Calls
===========
Called from: Source\test.prg => HTML( 95 )
Called from: Source\test.prg => MAIN( 19 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: UTF-8 con BOM
Posted: Thu Apr 03, 2025 09:02 AM

Dear Silvio,

Are you using this in your PRG ?

REQUEST HB_CODEPAGE_ITWIN

...

hb_SetCodePage( "ITWIN" )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 244
Joined: Mon Jun 05, 2006 09:39 PM
Re: UTF-8 con BOM
Posted: Thu Apr 03, 2025 06:44 PM
Silvio.Falconi wrote: ´
cHtml := Strtran(cHtml,_CodeUtf8Bom_,chr(239)+chr(187)+chr(191))
Error occurred at: 04/03/25, 09:18:56
Error description: Error BASE/1003 Variable does not exist: _CODEUTF8BOM_

Stack Calls
===========
Called from: Source\test.prg => HTML( 95 )
Called from: Source\test.prg => MAIN( 19 )
I forgot the quotes

cHtml := Strtran(cHtml,"_CodeUtf8Bom_",chr(239)+chr(187)+chr(191))
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: UTF-8 con BOM
Posted: Fri Apr 04, 2025 05:28 AM

Ep!,

Try saving your code from your editor in 'UTF8 WITHOUT BOM' format. If you save code with 'UTF8 WITH BOM', it can cause many such errors in many browsers.

C.

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix

Continue the discussion