2013-07-31 76 views
1

我正在使用PHP與netbeans IDE,我想打印一些特殊字符,但我不能得到任何工作,我已經嘗試了一些失敗的事情請幫助。打印特殊外來字符

這裏是我當前的代碼

header('Content-Type: text/html;charset=UTF-8'); 
    mb_internal_encoding("UTF-8"); 

    $str = "helloáéíóúñ言文一致"; 
    print $str; //hello������???? 

    print iconv(mb_detect_encoding($str), "UTF-8", $str) . "\n";//throws an error 


    if(strlen($str)!==strlen(utf8_decode($str))) print $str;    
    else print utf8_encode($str); 
    //prints hello������???? 

    print "\n" . mb_internal_encoding(); //UTF-8 

是否UTF-8甚至支持這些字符?我幾乎肯定它的確如此。

感謝

回答

0

在NetBeans中確保(主編)的源編碼是好的(可能的情況下): 項目屬性/來源/編碼:UTF-8。

嘗試直接輸出:

?> helloáéíóúñ言文一致 <?php 

確保您有網頁亞洲語言上完整的Unicode字體。

如果你現在看到好的結果,你可以試用PHP。

UTF-8是所有Unicode字符的多字節編碼。 Unicode編號表示所有語言的所有字符(小於或等於mkore)。

+0

我正在尋找將在NetBeans IDE中輸出的代碼。您的即時輸出建議完全不顯示。 mb_internal_encoding(「UTF-8」)確保源編碼是UTF-8 – ZJS