#39261 [Asn->Bgs]: strftime chops characters with utf-8
| From: | derick@php.net | Date: | Thu, 26 Oct 2006 21:21:12 +0000 |
| Subject: | #39261 [Asn->Bgs]: strftime chops characters with utf-8 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104030@lists.php.net to get a copy of this message | ||
ID: 39261
Updated by: derick@php.net
Reported By: mehmetyucel at gmail dot com
-Status: Assigned
+Status: Bogus
-Bug Type: Output Control
+Bug Type: Date/time related
Operating System: MS Windows 2003 ES/Fedora Core 5
PHP Version: 5.1.6
Assigned To: derick
New Comment:
strftime() behaves depending in the OS. As far as I can see it's not
even a bug and it's just how Windows handles locales and selects utf8
when it feels like.
Previous Comments:
------------------------------------------------------------------------
[2006-10-26 11:42:35] mehmetyucel at gmail dot com
5.2 snapshot solved the issue on linux, but problem still exists for
windows.
Somehow setlocale sets output encoding of strftime. Following works as
a temporary solution for window env.
iconv("ISO-8859-9","UTF-8",strftime("%d %B %Y
%A",strtotime("2006-10-26")));
------------------------------------------------------------------------
[2006-10-26 09:17:01] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-10-26 02:16:43] mehmetyucel at gmail dot com
Description:
------------
If the localization that is set by setlocale has non ISO-8859-1
characters strftime destroys these.
Reproducable on both Fedora Core 5 and Windows 2003 Enterprise Server
tested for 2 languages (Spanish / Turkish)
Reproduce code:
---------------
header('Content-Type: text/html; charset=utf-8');
setlocale(LC_TIME,"spanish");
echo strftime("%d %B %Y %A",strtotime("2006-10-28"))."<br>";
setlocale(LC_TIME,"turkish");
echo strftime("%d %B %Y %A",strtotime("2006-10-26"))."<br>";
echo strftime("%d %B %Y %A",strtotime("2006-10-25"))."<br>";
Expected result:
----------------
28 octubre 2006 sábado
26 Ekim 2006 Perşembe
25 Ekim 2006 Çarşamba
Actual result:
--------------
28 octubre 2006 sᢡdo
26 Ekim 2006 Per?r>25 Ekim 2006 ǡr?r>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39261&edit=1