WebHSP Community Forums
February 05, 2012, 05:56:09 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Members Login Register  
Pages: [1]
  Print  
Author Topic: Charset problem  (Read 5923 times)
Notawiz
Newbie
*
Offline Offline

Posts: 19


WWW
« on: May 11, 2005, 09:04:00 AM »

We recently moved from a cPanel shared hosting to a VPS plan.
Previously, the html entities displayed correctly.
We use:
Code:
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15" />
in all our pages (8859-15 for support of EURO sign), and that did well, till the move.

To be more explicit, before storage in database, we htmlentities() the data.
When just echoed as is, they are displayed correctly.
The problem occurs when we use html_entity_decode().
As an example, the French sentence:
Quote
comment &ecirc;tre s&ucirc;r du paiement ?
becomes:
Quote
comment кtre sыr du paiement ?
on our new VPS, but was correctly echoed:
Quote
comment ?tre s?r du paiement ?
on the previous cPanel server...

We were wondering if there is some specific setting that we overlooked, be it in the php.ini or in the Apache config, that could be responsible for this altered display?
Especially since we have noticed this on scripts that were not modified recently.

If someone could give us a lead as to which direction to search, that would be enough.

Thank you.
Jan
« Last Edit: May 11, 2005, 09:12:25 AM by Notawiz » Logged

Jan Van Aerschot
Xquisitus Technical Director
WHSP-Jarrod
Guest


Email
« Reply #1 on: May 11, 2005, 09:28:05 AM »

Hi Jan,

Would you be so kind as to PM me the domain name (or log a ticket in our helpdesk via https://ccc.webhsp.com/) in question so that I may compare server settings between the old cPanel server and your new VPS account?

Thank you!
Logged
Notawiz
Newbie
*
Offline Offline

Posts: 19


WWW
« Reply #2 on: May 29, 2005, 10:26:10 AM »

I update this post in the hope of receiving an answer that will enable me to correct this erroneous rendering.

I'll add that I believe that the charset in the metatag in the header of the generated page is of no importance, since the error happened while the source string with the entities was handled by the function html_entity_decode() of PHP.

But since I don't have to php.ini setting of the old cPanel shared server, I can not check for differences with the php.ini of the new VPS. If the problem is at all related to that, which I still ignore.

Thank you for looking into this matter.

Logged

Jan Van Aerschot
Xquisitus Technical Director
WHSP-Jarrod
Guest


Email
« Reply #3 on: May 30, 2005, 05:52:15 AM »

Hi Jan,

Please accept our sincerest apologies for the delay, we have finally found an answer to this which appears to be working.  We came across the following documentation and added the appropriate "AddCharset" line to your httpd.conf file, and aftere restarting apache, encoded characters appear to be displaying properly: http://www.iana.org/assignments/charset-reg/ISO-8859-15

If you would be so kind as to test your site again and let us know, we'll continue working on this as necessary.
Logged
Notawiz
Newbie
*
Offline Offline

Posts: 19


WWW
« Reply #4 on: May 30, 2005, 11:27:20 AM »

Hello Jarrod :-)

Tested, and nope, didn't work.

In the source of the page I still have:
Code:
<td><textarea rows="10" cols="35" name="message">
User wrote ======================
comment кtre sыr du paiement ?</textarea></td>
instead of:
Quote
comment ?tre s?r du paiement ?

And that looks rather logical to me, since the setting of Apache, as well as the metatag in the document header come after PHP has "decoded" the string.

I believe that the error comes from the working of the PHP function html_entity_decode(), but since on the cPanel server the decoding was done correctly, I don't know where to look for a correction.

I also posted this question on webmasterworld, without solution so far.

Would it be possible for you to forward me a copy of a "standard" php.ini on a cPanel shared server like nitro for example, just to check if there are differences?
It MUST be a silly little detail we're overlooking :-)

Regards
Logged

Jan Van Aerschot
Xquisitus Technical Director
WHSP-Danielle
Guest


Email
« Reply #5 on: May 30, 2005, 03:21:14 PM »

Hi Jan,

We are continuing to look into this issue for you, and will hopefully have a resolution to this soon.

However in the meantime, here is a URL where you can view the phpinfo file on the server Nitro:
http://88media.com/phpinfo.php
(It is the site of a current customer of ours, I set up the phpinfo file so that you can view the exact php details for the Nitro server)

If you now create a phpinfo.php file on you current vps account and enter in the following code as is:

<?php
phpinfo();
?>

You will be able to see the php details for your new account.

Thanks
Danielle M.
Logged
Notawiz
Newbie
*
Offline Offline

Posts: 19


WWW
« Reply #6 on: June 02, 2005, 11:41:19 AM »

Hello Danielle,

I thank you for letting me look into the nitro php.ini file.

I will carefully compare this with the VPS php.ini file, and will come back with the results of my review.

Over here, it is far over time to stop working :-)
Logged

Jan Van Aerschot
Xquisitus Technical Director
Notawiz
Newbie
*
Offline Offline

Posts: 19


WWW
« Reply #7 on: June 02, 2005, 03:40:46 PM »

Hello Danielle, Jarrod and fellows,

I finally got it right.

Thanks to the access you gave me to the nitro php.ini, I was able to compare that with the php.ini of our current VPS server.

Apart a different setting in the mbstring extension, no lead to a solution. All charset settings were exactly the same between two types of servers. But many other differences due to a different build and installation of PHP.

Since it could be of any help to other users, here is what I did:
To have a look at what the HTML entities are, I wrote a little script with:
Code:
$trans_tbl = get_html_translation_table(HTML_ENTITIES);

echo "<pre>";
print_r($trans_tbl);
echo "</pre>";
And indeed, got a totally wrong entity encoding/decoding. I'm not sure, but it looked like Russian to me.

To force PHP to behave "my" way, I uncommented the default_charset of the PHP config and set it to ISO-8859-15. Even though that was empty on the cPanel (but with another build and version of PHP).
After restarting Apache, my entities are correctly handled by the html_entity_decode() function.

Phew, that was a tough one ;-)
Logged

Jan Van Aerschot
Xquisitus Technical Director
WHSP-Danielle
Guest


Email
« Reply #8 on: June 02, 2005, 07:46:21 PM »

Hi there,

I'm so glad to hear that this is working for you, and that the php.ini file from Nitro was a great help to you!

Danielle
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!