Unknown characters in PHP date

Asked

Viewed 67 times

0

I am trying a problem with unknown characters on the date of a site, I have put all the parameters I believed to remedy the problem, but it continues to happen.

"Saturday, April 16, 2016" is coming out "S? BADO, April 16, 2016"

How can I fix this? Thank you

<?php setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); date_default_timezone_set('Europe/Lisbon'); echo mb_strtoupper(strftime('%A, %d de %B de %Y', strtotime('today')), 'UTF-8'); ?>

  • Probably your page is not in UTF-8, but you are asking for this encoding in mb_strtoupper. Change the 'UTF-8' for 'ISO-8859-1' to test.

  • @Bacco, thanks! I have the page defined with the <meta charset="UTF-8"/>. I made this change that you said and the fault continues, but the character changed, being "S BADO". I ask in mb_strtoupper because I really need everything in upper case, but I did a test and removed mb_strtoloupper and also gives the character failure in minuscules.

  • @Totalshockpubli In what encoding is saved your file this script?

  • See if this helps: http://answall.com/a/43205/3635

  • @Totalshockpubli remove UTF-8 completely and leave alone mb_strtoupper(strftime('%A, %d de %B de %Y', strtotime('today'))); to see if it’s not double encoding

  • @Bacco, I did with you indicated and continued the character failure. (I used your code same). Strange this. both on localhost and server the same fault. What will it be? If you use this code, Voce sees the fault on your PC colleague? Thank you

  • @Any way out of this personal glitch? Thanks

  • @Totalshockpubli I’m almost sure it’s some silly, but it’s complicated to help in the current context. My suggestion would be you take the mb_strtoupper for now, and start with an empty page with no locale or anything. Only with this: echo strftime('%A, %d de %B de %Y', strtotime('today')), 'UTF-8'); - Nothing else on the test page. Then if it doesn’t work correctly, you just add a basic HTML around the function, with <meta charset="UTF-8"> to see if it resolves. Then we increase.

  • @Baco, I am a question here colleague, how can I call an earlier date that contains the strange character? type so, I could see the strange characters on Saturday or Tuesday, (A) and (Ç) calling Oday, these days, or Yesterday the day before, but today is Thursday and call Oday and yestarday caught Friday and Wednesday that do not feature bowel characters, has some way of calling Saturday and Tuesday, being today Thursday?

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.