#4207 (ok 4.4.3) json_encode error , because strftime return string is not utf8 in Windows 8.1 Chinese version

4.1.2
fixed
Low
2015-04-20
2013-12-30
Pigo Chu
No

Util.class.php
line 1656 : return strftime($date, $timestamp);
this line will not return a utf-8 string on my win8 os , but on my linux(centos 6.5) is correct.
So everytime we got false by json_encode() in Response.class.php

My Env :
OS : Win8.1 Traditional Chinese version
PHP: 5.5.7

Discussion

  • Pigo Chu
    Pigo Chu
    2014-01-01

    This bug still exists in version 4.1.3.
    I think this bug exists in any non-English Windows OS.
    I use date( ... ) replace strftime(...) now , this should work for me.
    But when I use date(...) , this method will not return a localisedDate :p

     
  • Ann + J.M.
    Ann + J.M.
    2014-01-15

    • labels: --> javascript, utf8
     
  • Ann + J.M.
    Ann + J.M.
    2014-01-15

    Which webserver software is running on your Windows machine—IIS, Apache or Lighttpd?

     
  • Pigo Chu
    Pigo Chu
    2014-01-15

    Apache and php in fastcgi mode

     
  • I am not sure whether this is a bug at phpmyadmin level.

     
  • Pigo Chu
    Pigo Chu
    2015-04-02

    I am sure this is phpmyadmin bug. We can not use strftime to localize string , because the none-english Winodws OS may use other charset not utf-8 , in my os , it will return big5 string , so the browser can't decode the json string.

    please look
    http://php.net/manual/en/function.strftime.php

    Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). Additionally, not all platforms support negative timestamps, so your date range may be limited to no earlier than the Unix epoch. This means that %e, %T, %R and, %D (and possibly others) - as well as dates prior to Jan 1, 1970 - will not work on Windows, some Linux distributions, and a few other operating systems. For Windows systems, a complete overview of supported conversion specifiers can be found at » MSDN.

     
  • Pigo Chu
    Pigo Chu
    2015-04-02

    I have a simple way to repair it.

    1. check the server os is windows or not
    2. if server os is windows , don't use strftime() to localize date , just return date('Y-m-d H:i:s')
     
    • I'm afraid this would be too restrictive since phpMyAdmin works fine on Windows 8.1 English version.

       
      Attachments
    • assigned_to: Madhura Jayaratne
     
  • Can you try the attached patch and see whether it fixes the bug?

     
    Attachments
    • status: open --> pending
     
  • Pigo Chu
    Pigo Chu
    2015-04-14

    Dear Madhura Jayaratne ~

    Thank q very much , this patch fixed the bug. ^^

     
    • summary: json_encode error , because strftime return string is not utf8 in Windows 8.1 Chinese version --> (ok 4.4.3) json_encode error , because strftime return string is not utf8 in Windows 8.1 Chinese version
    • status: pending --> resolved
    • Priority: Normal --> Low
     
  • Marc Delisle
    Marc Delisle
    2015-04-20

    • Status: resolved --> fixed