Bug #65371 [Fbk->NoF]: strftime() returns insufficient string

From: Date: Sun, 01 Feb 2015 04:22:15 +0000
Subject: Bug #65371 [Fbk->NoF]: strftime() returns insufficient string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190372@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65371&edit=1

 ID:               65371
 Updated by:       php-bugs@lists.php.net
 Reported by:      kenji dot uui at gmail dot com
 Summary:          strftime() returns insufficient string
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          Date/time related
 Operating System: Windows
 PHP Version:      5.5.1
 Assigned To:      ab
 Private report:   N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2015-01-23 12:41:33] ab@php.net

OK, after some testing i can now reproduce this behavior even with english system locale. For that,
just use

setlocale(LC_ALL, "japanese");

I've also tested a bit more and it looks that at least codepages 932, 936, 950 affect strftime
to be working a different way, at least with vc11. I made a mini build with vc12, so you can test it
http://windows.php.net/downloads/snaps/ostc/65371/
(you'll need the 64 bit crt redistributable http://www.microsoft.com/en-US/download/details.aspx?id=40784).

But actually I'm more like don't believe it's about CRT but the strftime and locale
itself. It seems to build a special case along with the code pages listed above (and maybe more).
Many other locales which set a single byte code page show correct behaviors when passing utf8
strings to strftime. Yet another try could be with using _strftime_l, however it's the same as
strftime just needs an explicitly passed locale, so more like a no-go.

Thanks.

------------------------------------------------------------------------
[2015-01-22 22:31:46] kenji dot uui at gmail dot com

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');
}

------------------------------------------------------------------------
[2015-01-22 21:36:48] kenji dot uui at gmail dot com

I tested on PHP 5.5.21. Not fixed yet.

Results:
----------------
あ
ぁE
e38182
e3818145

------------------------------------------------------------------------
[2015-01-22 12:01:18] ab@php.net

Could you please revisit this? There was a lot of locale fixes recently, you could check 5.5.21 or
just some recent 5.5 on windows.php.net .

Thanks.

------------------------------------------------------------------------
[2014-01-11 13:39:27] kenji dot uui at gmail dot com

I found Windows system locale affects the result.
I changed it to English(US), then I got expected result.

The problem occurs in Japanese locale.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65371


--
Edit this bug report at https://bugs.php.net/bug.php?id=65371&edit=1


Thread (10 messages)

« previous php.bugs (#190372) next »