Update on strcoll() UTF-8 issue

December 8, 2008 at 11:45 1 comment

I just stumpled upon a comment in the Zend Framework Issue Tracker about an UTF-8 issue with PHP on Windows (the issue was about some problem within Zend_Ldap)  which pointed to a MSDN page about setlocale and _wsetlocale. It’s clearly stated there that the CRT function setlocale() does not work with multi-byte charsets on Windows:

The set of available languages, country/region codes, and code pages includes all those supported by the Win32 NLS API except code pages that require more than two bytes per character, such as UTF-7 and UTF-8. If you provide a code page like UTF-7 or UTF-8, setlocale will fail, returning NULL. The set of language and country/region codes supported by setlocale is listed in Language and Country/Region Strings.

That means that setlocale() does not work on Windows when given a locale with an UTF-8 charset, e.g. German_Germany.65001, and therfore you cannot use strcoll() or similar functions for locale-aware string operations with these charsets. It simply is not possible due to a Windows CRT limitation.

About these ads

Entry filed under: PHP. Tags: , .

How to use the new Zend_Ldap functionality Screenshots of game sheets-app for Eishockey.net

1 Comment Add your own

  • 1. Update on strcoll() UTF-8 issue | PHP-Blog.com  |  December 8, 2008 at 17:45

    […] posted here: Update on strcoll() UTF-8 issue Related ArticlesBookmarksTags Alot has happened recently :) Update time! Andrew is a […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Current articles


  • RT @GaryLineker: If Blatter had even a crumb of dignity remaining, he'd walk away now, creep back to his lair, sit in his armchair and stro… 13 hours ago
  • @DB_Bahn welcher Zug ist zuerst von Stuttgart in Heilbronn? RE4950 (verspätete Bereitstellung) oder RB39926 (technische Störung)? 1 week ago
  • RT @beberlei: "The majority of software systems should be built as a single monolithic application" by @martinfowler martinfowler.com/bliki/Microser… 2 weeks ago
  • RT @channingwalton: “Estimate?” “Why?” “For the plan!” “And when I’m wrong?” “We change the plan.” “That all?” “Yup.” “1 year.” “Unacceptab… 2 weeks ago
  • @DB_Bahn "Wegen hoher Streckenauslastung hat unser Zug derzeit 15 Minuten Verspätung" - ein Glück, dass heute nicht alle Lokführer da sind! 3 weeks ago




Get every new post delivered to your Inbox.

%d bloggers like this: