UTF-8 con BOM

Post Reply
User avatar
Silvio.Falconi
Posts: 7238
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

UTF-8 con BOM

Post by Silvio.Falconi »

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

Code: Select all | Expand

 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
User avatar
cnavarro
Posts: 6630
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 6 times
Been thanked: 10 times

Re: UTF-8 con BOM

Post by cnavarro »

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
User avatar
Silvio.Falconi
Posts: 7238
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: UTF-8 con BOM

Post by Silvio.Falconi »

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
User avatar
Giovany Vecchi
Posts: 226
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: UTF-8 con BOM

Post by Giovany Vecchi »

Try this

Code: Select all | Expand

 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))
User avatar
Silvio.Falconi
Posts: 7238
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: UTF-8 con BOM

Post by Silvio.Falconi »

´
Giovany Vecchi wrote: Mon Mar 31, 2025 10:12 pm 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
User avatar
Antonio Linares
Site Admin
Posts: 42775
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 116 times
Been thanked: 109 times
Contact:

Re: UTF-8 con BOM

Post by Antonio Linares »

Dear Silvio,

Are you using this in your PRG ?

REQUEST HB_CODEPAGE_ITWIN

...

hb_SetCodePage( "ITWIN" )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Giovany Vecchi
Posts: 226
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: UTF-8 con BOM

Post by Giovany Vecchi »

Silvio.Falconi wrote: Thu Apr 03, 2025 7:19 am ´
Giovany Vecchi wrote: Mon Mar 31, 2025 10:12 pm 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))
User avatar
Carles
Posts: 1156
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona
Been thanked: 8 times
Contact:

Re: UTF-8 con BOM

Post by Carles »

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
Skype -> https://join.skype.com/cnzQg3Kr1dnk
Post Reply