[SOLVED] Display full date with accents properly

V@lentine 03 Feb, 2011
Hello,

I'm trying to display the date in a text field, but I get a ? symbol in a diamond in place of my French accents.
This is how I coded :
      
<input class="cf_datetime required" title="" size="22" id="date_5" name="dateContrat" type="text"  value="
<?php 
	  	setlocale (LC_TIME, 'fr-FR'); 
		print strftime("%A %d %B %Y %T");
?>
" />


I supposed this is linked to the page which is in UTF-8, but I didn't find where the headers are defined in Joomla, and before changing charset, I'd rather find a solution just for that, because I don't have the problem elsewhere.
I went to check setlocale() and strftime() functions but found no clue there...
I know most of you don't need any accents, but I you had an idea, I'd be glad, particularly because I get "f?vrier" instead of "février" in my database !
Thanks for kind help !
GreyHead 03 Feb, 2011
Hi V@lentine,

I think you need to add a character set. This works on a Linux site
setlocale(LC_TIME, 'fr_FR.UTF8');
(But not on my local Windows+XAMPP test server.)

Bob

PS Personally, I'd never(?) save a data in this format into the database. There are two many potential problems in recovering it again. I'd use a TIMESTAMP or DATETIME. Though if you need an absolute record I guess there is a case for the string.
V@lentine 03 Feb, 2011
It doesn't work, I'm using WAMP2, on a Windows server too.
I need to have the date fully displayed as my form will generate a contract in PDF and the date needs to be written in full letters...
I sure could use a timestamp to save in the database, but I still need to display it properly for my users before.

I tried to add this line in the begining of my "Form Code" :
header('Content-Type: text/html; charset=ISO-8859-15');

But it's just ignored.
V@lentine 03 Feb, 2011
I've searched further and finally found it :
setlocale(LC_ALL, 'fr_FR.utf8', 'fra');
echo htmlentities(strftime("%A %d %B %Y %T");
This topic is locked and no more replies can be posted.