Req #75922 [Fbk->Opn]: default_charset cannot be disabled in Content-Type
Edit report at https://bugs.php.net/bug.php?id=75922&edit=1
ID: 75922
User updated by: bugs at jth dot net
Reported by: bugs at jth dot net
Summary: default_charset cannot be disabled in Content-Type
-Status: Feedback
+Status: Open
Type: Feature/Change Request
Package: PHP options/info functions
Operating System: Linux
PHP Version: 7.1.14
Block user comment: N
Private report: N
New Comment:
You are in no position to require that users should use a single character set in PHP. There are a
number of reasons why different charsets and languages should coexist on the same web server. It was
working perfectly fine in php5, but is now broken after upgrading to php7.
Apache2 httpd.conf
#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
#AddDefaultCharset UTF-8
This is working by commenting out or specifying
AddDefaultCharset Off
There should be a similar option in PHP
I have experimented with
default_charset = ""
internal_encoding = "UTF-8"
which apparently is working, but I am not sure, especially not when the PHP documentation states
"Setting default_charset to an empty value is not recommended."
Previous Comments:
------------------------------------------------------------------------
[2018-02-06 09:31:48] requinix@php.net
Having default_charset not match the actual charset used is a recipe for disaster. Why aren't
they changing that?
------------------------------------------------------------------------
[2018-02-06 09:16:40] bugs at jth dot net
Description:
------------
default_charset in php7 is now a mess being used in two different contexts. It should be two
different options: one for internal encoding and one for enabling/disabling being output in the
Content-Type: header.
The Content-Type: header is overriding the meta tag in the document, which different users are
creating in different charsets using the meta tag.
php is often used for simple functions not involving or regardless of the charset
e.g. database functions.
It is a nuisance and prone to error having the users to specify the charset both as an unnecessary
header() call and as a meta tag.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75922&edit=1
Thread (8 messages)