dsrnwngq411594 2009-12-28 11:51
浏览 95
已采纳

如何在PHP中显示非英文字符?

I've a basic question in PHP:

I've 2 files: An HTML form with a Textarea and a PHP file. All I want is to print the text the user types after submit is pressed. It all goes well when only English characters are typed but I get gibberish when I type Arabic or Chinese for instance. Is there a way to display all the characters?

Here is the code of the PHP file:

<?php
     $txt = $_GET['toTranslate'];
     echo $txt;
?>
  • 写回答

3条回答 默认 最新

  • dream07769 2009-12-28 11:56
    关注

    Please try to add

    header('Content-Type: text/plain; charset=UTF-8');
    

    or Add set as html and set

    echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
    echo $txt;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?