French Characters Not Showing Properly

hi .

I’m having an issue where I can’t seem to get the proper French characters to show up

I this code




	$locale = 'fr_FR.UTF-8';

	setlocale(LC_ALL, $locale);

	$event_date =  utf8_encode(strftime($format,strtotime(date("Y-m-d", strtotime("27th August 2013")) . " +".$day." day")));

for some reason it does not work…well, it returns the proper date in French so that works but the month of August which has an accent in it does not process properly

I get this


Mercredi - 28 août, 2013

instead of


Mercredi - 28 août, 2013

any ideas why this would be?

thanks

solved…

not sure why I had this at the start of the line

utf8_encode

that was re-encoding the text …that’s why it didn’t work :)

Hello

Maybe your server doesn’t understand ‘[font=“Courier New”]fr_FR.UTF-8[/font]’ locale? Have you tested with ‘[font=“Courier New”]fr_FR[/font]’ first, especially that you utf8_encode it later?

In any case, you may want to include all locale variations as successive strings, or array values:


$locale = array('fr', 'fr_FR', 'fr_FR@euro', 'fr_FR.utf8', 'fr_FR.UTF-8', 'fr-FR', 'fra');

Or maybe the French locale isn’t activated on your server? Google it…

Also, why don’t you use Yii date formatter? It works perfectly in my case (on Linux and Windows Server and OS X):

http://www.yiiframework.com/doc/api/1.1/CDateFormatter

http://www.yiiframework.com/forum/index.php/topic/28846-date-format/

EDIT:

Ok, late answer for a problem already solved :)

You would have needed [font=“Courier New”]utf8_encode[/font] if your server didn’t support/have UTF8 locale (as in [font=“Courier New”]$locale = ‘fr_FR’;[/font] for instance).

humm…interesting… I’ll have to test it live… I was working locally so maybe once I dump it on my server maybe it won’t work…