Charset #PB_Web_HtmlCode

Just starting out? Need help? Post your questions and find answers here.
Paradox
User
User
Posts: 23
Joined: Tue Dec 09, 2014 7:16 pm
Location: Brasil

Charset #PB_Web_HtmlCode

Post by Paradox »

Not display characters Ã É Í

Code:

Code: Select all

Procedure teste()
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
    Protected web_gadget = WebGadget(#PB_Any, 10, 10, 580, 280, #Null$) 
    Protected html_code$ = "<!DOCTYPE html> "+
                           "<html lang='en'> "+
                           "<head> "+
                           "    <meta charset='UTF-8'> "+
                           "    <title></title> "+
                           " </head> "+
                           " "+
                           "<body class='landscape'> "+
                           "	<h1>Ã É Í </h1> "+
                           "</body> "+
                           "</html> "
    SetGadgetItemText(web_gadget,#PB_Web_HtmlCode,html_code$)
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow 
  EndIf
EndProcedure

teste()
Result:
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4659
Joined: Sun Apr 12, 2009 6:27 am

Re: Charset #PB_Web_HtmlCode

Post by RASHAD »

Hi
Use Html character code

Code: Select all

Procedure teste()
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected web_gadget = WebGadget(#PB_Any, 10, 10, 580, 280, #Null$)
    Protected html_code$ = "<!DOCTYPE html> "+
                           "<html lang='en'> "+
                           "<head> "+
                           "    <meta charset='UTF-8'> "+
                           "    <title></title> "+
                           " </head> "+
                           " "+
                           "<body class='landscape'> "+
                           "   <h1>&Atilde; &Eacute; &Iacute; </h1> "+
                           "</body> "+
                           "</html> "
    SetGadgetItemText(web_gadget,#PB_Web_HtmlCode,html_code$)
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
EndProcedure

teste() 
Egypt my love
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: Charset #PB_Web_HtmlCode

Post by Bisonte »

Or without the meta tag :

Code: Select all

Procedure teste()
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected web_gadget = WebGadget(#PB_Any, 10, 10, 580, 280, #Null$)
    Protected html_code$ = "<!DOCTYPE html> "+
                           "<html lang='en'> "+
                           "<head> "+
                           ""+
                           "    <title></title> "+
                           " </head> "+
                           " "+
                           "<body class='landscape'> "+
                           "   <h1>Ã É Í </h1> "+
                           "</body> "+
                           "</html> "
    SetGadgetItemText(web_gadget,#PB_Web_HtmlCode,html_code$)
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
EndProcedure

teste() 
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Paradox
User
User
Posts: 23
Joined: Tue Dec 09, 2014 7:16 pm
Location: Brasil

Re: Charset #PB_Web_HtmlCode

Post by Paradox »

Bisonte wrote:Or without the meta tag :

Code: Select all

Procedure teste()
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected web_gadget = WebGadget(#PB_Any, 10, 10, 580, 280, #Null$)
    Protected html_code$ = "<!DOCTYPE html> "+
                           "<html lang='en'> "+
                           "<head> "+
                           ""+
                           "    <title></title> "+
                           " </head> "+
                           " "+
                           "<body class='landscape'> "+
                           "   <h1>Ã É Í </h1> "+
                           "</body> "+
                           "</html> "
    SetGadgetItemText(web_gadget,#PB_Web_HtmlCode,html_code$)
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
EndProcedure

teste() 

Thanks!!
Post Reply