0

I am working on the php code below which returns the month names in french.

<script>
document.getElementById('title_fr').value = "<?php setlocale(LC_TIME, "fra"); echo strftime("%d %B %Y", strtotime( $this_date )); ?>";  
</script>

The above code returns the following months:

janvier
f�vrier
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
d�cembre

Problem Statement:

I am wondering what changes I need to make in the php code above so that it avoids question mark for f�vrier and d�cembre. It should return février and décembre

On head, I am using:

<meta charset="utf-8">
john
  • 11,311
  • 40
  • 131
  • 251
  • Make sure that _all_ the files you're using are saved in UTF-8. You can [check this answer out](https://stackoverflow.com/a/279279/2453432) for some more tips. – M. Eriksson Mar 14 '19 at 15:28
  • @deceze I tried your answer but it didn't work. – john Mar 14 '19 at 15:52
  • You tried *what exactly* and it did *what exactly*? – deceze Mar 14 '19 at 15:54
  • I tried this setlocale(LC_TIME, "fra.UTF-8", "fra.utf8", "fra"); What is doing that now that its converting month names into english. – john Mar 14 '19 at 15:55
  • List your installed locales (as explained in the duplicate). See what locales you actually have at your disposal. If the required one isn't there, figure out how to add it for your system. – deceze Mar 14 '19 at 16:02
  • On following this tutorial https://sciex.com/support/knowledge-base-articles/how-to-check-operating-system-locale-on-windows-7-1460458252426 I tried the following command `systeminfo | findstr “Locale”` and it doesn't return anything. – john Mar 14 '19 at 16:08
  • Hmm, no idea how to do any of that on Windows. But https://stackoverflow.com/a/3191729/476 would suggest the correct locale may be `fr-FR`… – deceze Mar 14 '19 at 16:13

1 Answers1

1

Try with this:

setlocale (LC_TIME, 'fr_FR.utf8','fra');