hananils/datetime — pull request #127 by xfrenette (2012-12-21 22:32:36+00:00)
Title: setlocale() on Windows and its UTF-8 encoding "peculiarity"

**The problem**
The DataSource outputs only english strings, even if another language is chosen in the Settings page.

**The problem arises when:**
- *The server is on Windows 2000 or later*
- You use the DateTime datasource
- You set (in the Settings page) the DataSource language to something other than english (ex: french).

**The reason:**
Recent Windows uses different locale codes than Unix based systems. Example: french is code "fra" or "french". [The full list is on MSDN](http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx).

So [this line](https://github.com/hananils/datetime/blob/master/data-sources/data.datetime.php#L89) will not change the locale on Windows, because none of the codes found [here](https://github.com/hananils/datetime/blob/master/extension.driver.php#L11-L20) are valid on Windows systems.

My pull requests adds the Windows language codes to [this array](https://github.com/hananils/datetime/blob/master/extension.driver.php#L11-L20).

# But!
Unfortunately, there is a problem! On Windows, PHP's function strftime() will return strings encoded in ISO-8859-1, and not in UTF-8.

A solution would be to do an encoding conversion (using iconv('ISO-8859-1', 'UTF-8', $str)) if on Windows.

My pull request shows a _quick_ example of solution.