php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69114 Undocumented 5.6 BC Break: default encoding ISO-8859-1 -> UTF-8
Submitted: 2015-02-24 13:00 UTC Modified: 2015-04-05 09:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: maggus dot staab at googlemail dot com Assigned: yohgaki (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.6.6 OS:
Private report: No CVE-ID: None
 [2015-02-24 13:00 UTC] maggus dot staab at googlemail dot com
Description:
------------
With PHP5.6 the default encoding changed from ISO-8859-1 to UTF8.
This bc break is not mentioned in the list of BC changes:

http://php.net/manual/en/migration56.incompatible.php

The charset related docs mention that 
    iconv.input_encoding
    iconv.output_encoding
    iconv.internal_encoding
    mbstring.http_input
    mbstring.http_output
    mbstring.internal_encoding
is deprecated as of 5.6 and we should use default_charset instead:
http://php.net/manual/en/ini.core.php#ini.default-charset

For non-utf8 legacy app which are updated to PHP5.6 it is not clearly documented how the path is. just setting ini_set('default_charset', 'ISO-8859-1'); does not do the trick, because of the deprecated above mentioned settings still default to UTF8.

It feels like non-utf8 apps can only be configured using deprecated settings like (which does not work by the way)
       	        ini_set('default_charset', 'ISO-8859-1');
                iconv_set_encoding("internal_encoding", 'ISO-8859-1');
                iconv_set_encoding("output_encoding", 'ISO-8859-1');
                iconv_set_encoding("input_encoding", 'ISO-8859-1');

How is the correct way to migrate a non-utf8 app to 5.6? How should the settings look like to be compatible to 5.5 defaults and also be future proof (so dont rely on deprecated settings)?
Such a path should be documented in the migration guide.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-12 12:27 UTC] carlos dot buenosvinos at gmail dot com
Same here. You also need to update your php.ini with mbstring.internal_encoding = "ISO-8859-1". Now everything is working. However, it looks like the fallback to default_charset is not working.
 [2015-03-16 14:22 UTC] proxymus at spaml dot de
In my case it helps to add the following to my .htaccess file

<Files ~ "\.php?$">
Header set Content-Type "text/html; charset=ISO-8859-1"
</Files>
 [2015-03-28 21:27 UTC] yohgaki@php.net
-Status: Open +Status: Feedback -Package: Documentation problem +Package: Unknown/Other Function -Assigned To: +Assigned To: yohgaki
 [2015-03-28 21:27 UTC] yohgaki@php.net
When these
    iconv.internal_encoding
    mbstring.internal_encoding
are empty, default_charset should be used. There was a bug and it was fixed. If there is another bug, please paste simple reproducible script here.

proxymus, what is user "default_charset"? If it sets to ISO-8859-1, then PHP should set charset to ISO-8859-1. I'm guessing that you have empty "default_charset". If this is the case, "default_charset=ISO-8859-1" should fix your problem.
 [2015-04-05 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2015-04-05 09:44 UTC] maggus dot staab at googlemail dot com
-Status: No Feedback +Status: Closed
 [2015-04-05 09:44 UTC] maggus dot staab at googlemail dot com
So, where can I find the documentation which desribes the correct updatepath for non-utf8 and php5.6?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC