[精讚] [會員登入]
455

編碼的順序

utf8 big5

分享此文連結 //n.sfs.tw/12369

分享連結 編碼的順序@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2018-05-13 17:19:04 最後編修
2018-05-13 16:40:33 By igogo
 

 

在 php的程式中 

先宣告 header 的編碼

<?php

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

 

可以優先於

httpd.conf中加上  

AddDefaultCharset big5

 

如此也不會因為httpd 中所設定的編碼

導到在  html中宣告

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

依舊受 httpd的 charset 影響而沒有作用

 

從底下圖可以觀察到 response header 的確是 utf8 了

 

這樣一來 , 即使在 httpd.conf 中設定了 強制big5 

 

browser 還是會因為 header 中的編碼  決定是utf8

END

你可能感興趣的文章

編碼的順序 utf8 big5

隨機好文

vue.js component 在parent與child 傳值 component 在parent與child 傳值

python 的RE python re

讀取特定資料夾下的xls檔 讀取特定資料夾下的xls檔

Spring Boot Maven wrappers maven, mvnw, build command

[shell script] 批次判斷domain name 正解設定 判斷dns 正解設定