Bug #74170 [PATCH]: locale information change after mime_content_type
| From: | turchanov@farpost.com | Date: | Thu, 29 Aug 2019 11:58:52 +0000 |
| Subject: | Bug #74170 [PATCH]: locale information change after mime_content_type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222482@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74170&edit=1
ID: 74170
Patch added by: turchanov@farpost.com
Reported by: viney91 at hotmail dot com
Summary: locale information change after mime_content_type
Status: Open
Type: Bug
Package: *Languages/Translation
Operating System: linux
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #74170: locale information change after mime_content_type
On GitHub: https://github.com/php/php-src/pull/4645
Patch: https://github.com/php/php-src/pull/4645.patch
Previous Comments:
------------------------------------------------------------------------
[2017-02-26 11:21:19] viney91 at hotmail dot com
Description:
------------
after mime_content_type function, the locale information is set with the file asked by
mime_content_type. Whe need to reset by setlocale() to retrieve the locale information what was
before calling mime_content_type().
NB: same issue with finfo_file()
Test script:
---------------
setlocale(LC_ALL, 'fr_FR.UTF-8');
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : beta (OK)
//
$mime=mime_content_type('sheet.xls'); // sheet.xls is not a UTF8 file.
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : b?t? (wrong)
//
$mime=mime_content_type('sheet.xls'); // sheet.xls is not a UTF8 file.
setlocale(LC_ALL, 'fr_FR.UTF-8');
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : beta (OK)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74170&edit=1