Yii Framework Forum: French Characters Not Showing Properly - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

French Characters Not Showing Properly Rate Topic: -----

#1 User is offline   Pabs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-March 11

Posted 15 June 2013 - 06:34 PM

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
0

#2 User is offline   Pabs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-March 11

Posted 15 June 2013 - 06:39 PM

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 :)
0

#3 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,168
  • Joined: 05-January 12
  • Location:Morocco

Posted 15 June 2013 - 07:04 PM

Hello

Maybe your server doesn't understand 'fr_FR.UTF-8' locale? Have you tested with 'fr_FR' 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.yiiframew.../CDateFormatter
http://www.yiiframew...46-date-format/

EDIT:
Ok, late answer for a problem already solved :)
0

#4 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,168
  • Joined: 05-January 12
  • Location:Morocco

Posted 15 June 2013 - 07:08 PM

View PostPabs, on 15 June 2013 - 06:39 PM, said:

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


You would have needed utf8_encode if your server didn't support/have UTF8 locale (as in $locale = 'fr_FR'; for instance).
0

#5 User is offline   Pabs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-March 11

Posted 15 June 2013 - 08:39 PM

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....
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users