问题描述
我在Windows 7中的PHP 5.3中遇到了setlocale函数的问题。我需要使用UTF-8编码设置俄语语言环境。我看到了一些解决方案,这是Russian_Russia.65001,但是这种类型的语言环境的函数返回FALSE。
所有解决方案都是为了在Windows XP中使用,其中列出了语言环境在控制面板中。在Windows 7中,此功能已被删除。
:
Windows代码页 Russian_Russia.1251
将工作(请参阅 Moodle表
您仍然可以尝试设置两者,看看哪一个来到:
if($ newLocale = setLocale(LC_CTYPE,'ru_RU.UTF-8','Russian_Russia.1251'))
{
echo'Locale现在设置为:'。 $ newLocale;
}
I have problem with setlocale function in PHP 5.3 in Windows 7.
I need to set Russian locale with UTF-8 encoding. I saw some solutions where this is Russian_Russia.65001, but the function with this type of locale returns FALSE.
All solutions was designed for using in Windows XP where list of locales was in Control Panel. In Windows 7 this feature was removed.
It's not possible to use UTF-8 locales on windows systems.:
Only windows code page Russian_Russia.1251
will work (see Moodle's table of locales).
You may still try set both and see which one comes trough:
if ($newLocale = setLocale(LC_CTYPE, 'ru_RU.UTF-8', 'Russian_Russia.1251'))
{
echo 'Locale is now set to: ' . $newLocale;
}
这篇关于PHP:Windows 7中的setlocale的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!