Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP:Windows7中的setlocale_Php_Windows_Encoding - Fatal编程技术网

PHP:Windows7中的setlocale

PHP:Windows7中的setlocale,php,windows,encoding,Php,Windows,Encoding,我对Windows7中PHP5.3中的setlocale函数有问题 我需要用UTF-8编码设置俄语区域设置。我看到了一些解决方案,其中这是Russian_Russia.65001,但是这种类型的区域设置的函数返回FALSE 所有解决方案都是为在Windows XP中使用而设计的,在Windows XP中,区域设置列表位于控制面板中。在Windows 7中,此功能已被删除。: 如果提供UTF-7或UTF-8之类的代码页,setlocale将失败,返回NULL 只有windows代码页俄罗斯语\俄罗

我对Windows7中PHP5.3中的setlocale函数有问题

我需要用UTF-8编码设置俄语区域设置。我看到了一些解决方案,其中这是Russian_Russia.65001,但是这种类型的区域设置的函数返回FALSE

所有解决方案都是为在Windows XP中使用而设计的,在Windows XP中,区域设置列表位于控制面板中。在Windows 7中,此功能已被删除。

如果提供UTF-7或UTF-8之类的代码页,setlocale将失败,返回NULL

只有windows代码页<代码>俄罗斯语\俄罗斯语.1251可以工作(请参阅)

您仍可以尝试同时设置这两个选项,并查看哪一个选项:

if ($newLocale = setLocale(LC_CTYPE, 'ru_RU.UTF-8', 'Russian_Russia.1251'))
{
   echo 'Locale is now set to: ' . $newLocale;
}

这在Windows7上对我很有效

putenv('LANG=fr_CA.UTF-8');
setlocale(LC_ALL,'fr_CA.UTF-8');
bindtextdomain('translation','./language');
bind_textdomain_codeset('translation','UTF-8');
textdomain('translation');
.po/.mo文件的路径

./language -> fr_CA.UTF-8 -> LC_MESSAGES -> translation.po
./language -> fr_CA.UTF-8 -> LC_MESSAGES -> translation.mo

这段代码是半天研究的结果:)我只希望微软有充分的理由不支持UTF-8。现在是2013年!当然这里fr_CA代表法裔加拿大人(不是俄罗斯人)欢迎使用SO,谢谢你的回答。如果你更详细地看这个问题,你会注意到它已经将近2年了,作者已经接受了他们认为充分回答了他们问题的答案。这个问题有近千种观点,所以有时候你可能会在这方面帮助别人,但实际上你的注意力最好集中在最近的问题上。再次感谢您的回答,非常感谢,我只是想引导您使用SO并参与社区。