php strftime法语字符 [英] php strftime French characters

查看:113
本文介绍了php strftime法语字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个用户可以在英语和法语之间切换的网站上工作.输出帖子的日期.

I'm working on a site where the user can switch between English and French. To output the date of posts.

如果用户选择法语,则使用:

If the user chooses French I use:

setlocale(LC_ALL, 'fra_fra');

然后输出我使用的日期:

Then to output the date I use:

strftime('%d %B %Y', strtotime($post->post_date));

我在utf-8的字符集是:

I have my charset at utf-8 with:

<meta charset="utf-8">

我遇到的问题是像û这样的字符,其他带有重音符号的字符显示为带有问号的黑色菱形.

The problem I have is characters like û and others with accents just display as the black diamonds with question marks in.

有没有办法解决这个问题?

Is there a way to fix this?

推荐答案

这似乎是strftime函数的问题/错误.

This seems to be a problem / bug with the strftime function.

您可以使用以下方法解决该问题:

You can solve it using:

$date_string = utf8_encode(strftime('%d %B %Y', strtotime($post->post_date)));

这篇关于php strftime法语字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆