Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Unicode display problems with PageProducer on WebBroker


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Dec 8, 2015 11:42 AM Last Post By: Miguel Angel Su...
Pet Devis

Posts: 1
Registered: 12/6/14
Unicode display problems with PageProducer on WebBroker  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 28, 2015 2:48 AM
Hello, I'm writing a multilanguage WebBroker application (for Apache 2.2) which display unicode encoded data from an oracle database. The same data with the same data-aware components (Devart's ODAC) in a test program written in Delphi XE7, are displaying correctly.
My problem occured in the WebBroker Dll where I'm facing with a strange behavior when I'm using a PageProducer to prepare the content for the response
When I'm using the follow code in the action :
Response.ContentType := 'text/html; charset=UTF-8';
PageProducer1.HTMLFile:= htmltemplate
Response.Content := PageProducer1.Content+'

Label 1 ='+Label1fromDB+' Label 2='+Label2fromDB+'

</body></html>';
Response.SendResponse;
the result in the webbrowser is that all the non-latin chars that was not inserted by the PageProducer but already existed in the htmltemplate file (which has declared as utf-8 with <meta charset="utf-8" />) replaced by other not correct chars, the text that was inserted by the PageProducer and was retrived from the database also not displayed correctly but the extra labels, Label1fromDB and Label2fromDB which are added to the content response as showing in the code above are displayed correctly having also the same chars which are inside the htmltemplate.

Now, when I omit the declaration Response.ContentType := 'text/html; charset=UTF-8', the content of the htmltemplate are diplaying correctly but all the other texts , the text filled by PageProducer and the two labels Label1fromDB and Label2fromDB not correctly

Can you please help me identify where the problem is and what have I do in order to be able to serve unicode multilanguage content via web broker?
Miguel Angel Su...

Posts: 11
Registered: 6/5/98
Re: Unicode display problems with PageProducer on WebBroker  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2015 11:42 AM   in response to: Pet Devis in response to: Pet Devis
Hello,

Try with the following tips:

1) Save the template (html file) as a file with UTF-8 codification. Review http://redhotwords.com/unicode.html

2) Put the meta charset="UTF-8" into the template (html file), Review http://www.w3schools.com/tags/att_meta_charset.asp

3) I think that you must to remove the following line in the source code in Delphi:
Response.ContentType := 'text/html; charset=UTF-8';

4) The template (html file) for the PageProducer must be a "complete" html page, and you must use HTML-transparent tags and replace their values with Label1fromDB and Label2fromDB values, using the event handler OnHTMLTag of the PageProducer. Review http://docwiki.embarcadero.com/RADStudio/Seattle/en/Using_Page_Producer_Components

I hope this information helps you solve your problem.

Regards,

Miguel Angel Suarez
KIUX
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02