|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-07-02 15:50 UTC] k-yamashita at ver2 dot jp
Description: ------------ VC11's strftime() returns number of wide characters rather than bytes but PHP seems to rely on it to determine byte length. http://connect.microsoft.com/VisualStudio/feedback/details/766205/vs2012-strftime-has-incorrect-return-value-in-vc-11-with-multibyte-codepages Test script: --------------- <?php setlocale(LC_ALL, 'Japanese_Japan.932'); echo strftime('%A'); Expected result: ---------------- >php a.php | od -t x1 0000000 90 85 97 6a 93 fa 0000006 Above is Shift JIS encoded Japanese word for "Wednesday". Other week days are all 6 bytes long too. Actual result: -------------- >php a.php | od -t x1 0000000 90 85 97 0000003 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
It works fine. Thanks a lot! Well, checking byte values will fail if unit test is performed on other than Wednesday. I suggest just checking the length. --FILE-- <?php setlocale(LC_ALL, 'Japanese_Japan.932'); echo strlen(strftime('%A')) . "\n"; ?> ===DONE=== --EXPECT-- 6 ===DONE===