php tcpdf不显示strftime的重音字符
so I'm setting the locale with
setlocale(LC_TIME, "fr_FR");
and then using strftime like so
$membershipStartDate = strftime('%A le %e %B %G', strtotime($_POST['membershipStartDate']));
this is working but the spelling of August in french is wrong. It's outputting the %B as "aot" when it should be "août"
anybody have any ideas?
EDIT: it looks like it might be a problem with TCPDF. If I use the Write() method with accents in a string it works. But if I use the strftime() function those accents do not show up. Using strftime() outside of TCPDF works as well.
$pdf->Write(0,'août','',0,'L',false,0,false,true,0); // accents output correctly
$pdf->Write(0,$membershipStartDate,'',0,'L',false,0,false,true,0); // doesn't show accents
所以我用 p>
setlocale设置语言环境( LC_TIME,“fr_FR”);
code> pre>
然后像这样使用strftime p>
$ membershipStartDate = strftime(' %A le%e%B%G',strtotime($ _ POST ['membershipStartDate']));
code> pre>
这是有效但八月的拼写用法语 是错的。 当它应该是“août”时输出%B为“aot” p>
任何人都有任何想法吗? p>
编辑:看起来它可能会 是TCPDF的问题。 如果我在字符串中使用带有重音符号的Write()方法,它就可以工作。 但是,如果我使用strftime()函数,那些重音符号就不会显示出来。 使用TCPFF的strftime()
outout也可以。 p>
$ pdf->写(0,'août','',0,'L',false, 0,FALSE,TRUE,0); //重音输出正确
$ pdf->写(0,$ membershipStartDate,'',0,'L',false,0,false,true,0); //不显示重音
code> pre>
div>
Wrapping strftime() in utf8_encode() solved it. Not sure if it's a bug with strftime() or TCPDF.
$membershipStartDate = utf8_encode(strftime('%A le %e %B %G', strtotime($_POST['membershipStartDate'])));