Bug #11951 Updated: HTML encoding problem

From: Date: Mon, 06 Aug 2001 13:27:27 +0000
Subject: Bug #11951 Updated: HTML encoding problem
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-62253@lists.php.net to get a copy of this message
ID: 11951
Updated by: andy
Reported By: bogo@cyberdude.com
Old Status: Feedback
Status: Closed
Bug Type: Unknown/Other Function
Operating System: Any
PHP Version: 4.0.5
New Comment:

no feedback

Previous Comments:
------------------------------------------------------------------------

[2001-07-07 19:52:59] joey@php.net

Have you checked the default_charset in your php.ini?

------------------------------------------------------------------------

[2001-07-07 18:18:16] bogo@cyberdude.com

There definately seems to be a problem using any operating system I've tried (Linux Debian,
RedHat, Windows 98, Windows 2000). The problem is that the following piece of HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=windows-1251">
.......

will somehow be ignored, i.e. the document will not have this encoding set, instead ISO-8859-1 will
be used. The biggest problem is that if try to change the encoding in the browser it won't
change it, even though the browser will show it changed or if it changes it (very rare), after you
reload the page the encoding is set back to ISO-8859-1, even though the browser always shows that
the encoding is changed. This happens for all files that are processed by the php engine. I've
correctly set the encoding option in the php.ini, even though it is always best for php, not to set
this at all, since if you're using a remote server, for example hosting you site in the USA,
but the page is in cyrillic, your php pages will never display properly. Probably the best thing is
to leave the encoding up to the HTML headers set by each page.

My workaround for this problem is (it always works correctly):
<?
  include "set_encoding.inc";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=windows-1251">
........

where set_encoding.inc, contains in my case the following:
  header("Content-type: text/html;charset=windows-1251");
  header("Content-Language: bg");



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=11951&edit=1



Thread (3 messages)

« previous php.dev (#62253) next »