0

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 !

EMG
  • 101
  • 2
  • 3
  • 10

3 Answers3

2

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>
mlkammer
  • 200
  • 11
  • Oh yes, sorry for that too... I correct these (huge) mistakes but the problem still the same... – EMG Aug 08 '13 at 14:49
0

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.

Jonast92
  • 4,964
  • 1
  • 18
  • 32
  • It does not work. I think that the string has to be the same as one of the `locale` ouput... – EMG Aug 08 '13 at 14:54
  • I edited my post. It's worth a shot. If it's not it then I'm simply out of clues, sorry. – Jonast92 Aug 08 '13 at 15:05
-1

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

Remko
  • 968
  • 6
  • 19