|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-01 11:42 UTC] kenji dot uui at gmail dot com
Description:
------------
strftime() breaks UTF-8 Japanese characters.
It worked fine in PHP 5.4.
Test script:
---------------
<?php
function p($str)
{
echo $str, '<br>';
echo strftime($str), '<br>';
echo bin2hex($str), '<br>';
echo bin2hex(strftime($str)), '<hr>';
}
setlocale(LC_ALL, 'C');
p('あ');
Expected result:
----------------
あ
あ
e38182
e38182
Actual result:
--------------
あ
ぁE
e38182
e3818145
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
I hear this bug is because of VC11 strftime. Workround is below: function strftime_win($str) { $str = mb_convert_encoding($str, 'CP932', 'UTF-8'); return mb_convert_encoding(strftime($str), 'UTF-8', 'CP932'); }