Reputation: 101
I have created a website using iso-8859-1
encoding, and I want to display the date in French.
Here is the file I use for test :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="ISO-8859-1"/>
</head>
<body>
<?php setlocale(LC_ALL, "fr_FR.iso88591"); echo strftime("%A %d %B %Y."); ?>
</body>
</html>
When I open this file I get : Thursday 08 August 2013.
instead of Jeudi 08 Août 2013.
(french).
I have tried using UTF-8
and it works correctly but it is not what I want...
I have checked the language packages installed on my server and everything seems correct :
server$ sudo locale -a
C
C.UTF-8
français
french
fr_FR
fr_FR.iso88591
fr_FR.utf8
POSIX
If you have any ideas to solve this problem it would be very cool.
EDIT : typos corrected !
Upvotes: 0
Views: 3184
Reputation: 4967
Like I pointed out in my comment, it should be setlocale, not setlocal.
A quick Google search pointed me to this website which indicates that you should be doing
setlocale(LC_ALL, "fr_FR.ISO-8859-1");
instead of
setlocal(LC_ALL, "fr_FR.iso88951");
EDIT :
Try this:
<?php
setlocale(LC_ALL, "fr_FR.iso88591");
setlocale(LC_NUMERIC, 'C');
echo strftime("%A %d %B %Y.");
?>
I haven't tried it but it's worth a shot.
Upvotes: 0
Reputation: 958
Typo in your code (setlocal should be setlocale):
<?php setlocale(LC_ALL, "fr_FR"); echo strftime("%A %d %B %Y."); ?>
Also make sure the French locale is available on your system:
locale -a
To see what locales are available (unix).
Upvotes: -1
Reputation: 200
You had typos. Change the "setlocal" and "8895-1"
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="ISO-8895-1"/>
</head>
<body>
<?php setlocal(LC_ALL, "fr_FR.iso88951"); echo strftime("%A %d %B %Y."); ?>
</body>
</html>
to "setlocale" and "8859-1", respectively.
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="ISO-8859-1"/>
</head>
<body>
<?php setlocale(LC_ALL, "fr_FR.iso88591"); echo strftime("%A %d %B %Y."); ?>
</body>
</html>
Upvotes: 2