問題描述
一切都在問題中:我有一個(gè) UTF-8 文件的 PHP 腳本.在這個(gè)腳本中,我想這樣做:
Everything is in the question : I have a Php script that is a UTF-8 file. In this script I want to do this :
<?
echo "aê??
";
?>
如果我在 Windows 提示符下運(yùn)行它,我會(huì)得到這個(gè):
If I run it in a Windows prompt I get this :
C:php>php -c C:WINDOWSphp.ini -f mysqldump.php
├ó├?├?├╗
C:php>
我一直無法找到正確的轉(zhuǎn)換方案.我也試過這個(gè)代碼:
I've not been able to find the right conversion scheme. I've tried also this code :
$tab = mb_list_encodings();
foreach ($tab as $enc1) {
foreach ($tab as $enc2) {
$t=mb_convert_encoding("aê??
", $enc1, $enc2);
if (strlen($t)<14) {
echo $enc1." ".$enc2." = ".$t."
";
}
}
}
我沒有找到正確的轉(zhuǎn)換!
And I didn't find the right conversion !
任何幫助將不勝感激
推薦答案
你讓我走上了正軌,但出現(xiàn)了一些問題(我喜歡 Windows o/):
You put me on the right track but there was kinddof a problem (I love Windows o/) :
C:php>chcp 65001
Page de codes active?: 65001
C:php>php -c C:WINDOWSphp.ini -f mysqldump.php | more
Mémoire insuffisante.
Mémoire insuffisante = 內(nèi)存不足.
Mémoire insuffisante = not enough memory.
如果我嘗試
C:php>chcp 1252
C:php>php -c C:WINDOWSphp.ini -f mysqldump.php
C:php>éé????????a?ü
它有效.只有上帝知道為什么.但它有效.謝謝你讓我走上正軌!!
it works. Only God knows why. But it works. Thanks for putting me on the right track !!
順便說一句,php代碼正確地形成UTF8到命令提示符是:
By the way the php code to go properly form UTF8 to command prompt is :
echo mb_convert_encoding($utf8_string, "pass", "auto");
這篇關(guān)于PHP UTF-8 轉(zhuǎn) Windows 命令行編碼的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!