-
-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows server, php-generated utf-8 days with accents not displayed correctly #973
Comments
Wondering if ... in
What about adding this to your configure.php file (just to force your PHP into all-utf8, to hopefully make it auto-encode these locale-generated strings as utf8 by default)? ini_set('default_charset', "UTF-8"); |
(and, yes, I'd welcome a demo copy of your spanish language pack ... care to post a download URL?) |
regarding the encoding issue on windows |
Sigh. It's incredibly unfortunate that Windows remains so inferior in its support of things as simple as locales in this modern era. It's frustrating to have to code exceptions specifically for Windows. Or is this unique to Xampp? |
I'd recommend the following slight alteration from your posted code from this:
to this: $retVal = strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year));
if (stristr(PHP_OS, 'win')) return utf8_encode($retVal);
return $retVal; BUT ALSO: |
Can't say, I did the post to encourage more results from real servers. Xampp is not a real-world reference but it's all I've got to go on. I have seen the question about corrupted days crop up now and again so it evidently is not a common issue/windows is not a common server. But, people think it is to do with their files/database.
No, all my sites are on the same hosting.
Yes, since Nix returns a utf-8 code ok by default, it gets corrupted by using utf8_encode on top of it.
Not sure what you mean by a "spanish server"? My sites are on Terranetworks UK. |
Oops ... meant to say: I don't have a spanish language pack to test a ZC site installed on a server in order to test any spanish locale concerns |
Ok, this is a first pass. |
Just to confuse things further, "interestingly" (not) is that if the locale is set to es-ES (on windows), this outputs the corrupted accent as previously seen: but this outputs a correct accent:
This issue is just not worth the effort, but at least the background mess is a bit more documented now. |
…orrectly Fixes zencart#973 using suggestion by @torvista
This has always been a problem on the Windows Xampp servers I use and is no different on Windows 10/php 7 for locale Spanish_Spain.1252.
I could not find any other way to solve this apart from treating windows differently as this is not a problem on my Nix server.
So for the two function zen_date_long,
I have had this in place for a long time:
return ( stristr(PHP_OS,"win") ? utf8_encode(strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year))) : strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year)) );
Maybe someone could comment if IIS has the same issue...
Note I have a working spanish language pack in progress for 1.6 if anyone wants it for testing.
The text was updated successfully, but these errors were encountered: