Smoekping 限定語系

No Comments

找到basepage.html 後,

在 <head></head> 中間, 加入下面這行即可。

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

資料來源:

http://plog.longwin.com.tw/my_note-programming/2009/07/14/html-utf8-browser-encoding-solution-2009

正確解法有下面幾種:

  1. 於 HTML head 指定此頁編碼為 UTF-8

    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
    </head>

  2. PHP 送 Header 告訴瀏覽器這頁是 UTF-8 編碼

    <?php
    header(“Content-Type:text/html; charset=utf-8”);
    ?>

  3. 設定 Apache 送出頁面預設語系 UTF-8 (比較不建議用此方法)

    addDefaultCharset UTF-8

    # 不過建議這行要包在 Directory 或 VirtualHost 內, 才不會影響到其它網頁.
    <Directory “/var/*/blog”>
    addDefaultCharset UTF-8
    </Directory>

    <VirtualHost *>
    addDefaultCharset UTF-8
    </VirtualHost>

Leave a Reply

Share via
Copy link