3
我需要字符集是UTF-8,這似乎是默認情況下。我最近啓用了幾個靜態頁面的頁面緩存:啓用軌道頁面緩存導致http頭字符集消失
caches_page :about
緩存工作正常,我看到在我的/公共文件夾中生成相應的about.html和contact.html頁面,當頁面呈現除,它是不再使用utf-8。
google搜索了一下後,我試圖尋找與wget的HTTP頭,前後緩存後:
第一次:
$wget --server-response http://localhost:3000/about
HTTP request sent, awaiting response...
1 HTTP/1.1 200 OK
2 X-Ua-Compatible: IE=Edge
3 Etag: "f7b0b4dea015140f3b5ad90c3a392bef"
4 Connection: Keep-Alive
5 Content-Type: text/html; charset=utf-8
6 Date: Sun, 12 Jun 2011 03:44:22 GMT
7 Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
8 X-Runtime: 0.235347
9 Content-Length: 5520
10 Cache-Control: max-age=0, private, must-revalidate
緩存:
$wget --server-response http://localhost:3000/about
Resolving localhost... 127.0.0.1
Connecting to localhost[127.0.0.1]:3000... connected.
HTTP request sent, awaiting response...
1 HTTP/1.1 200 OK
2 Last-Modified: Sun, 12 Jun 2011 03:34:42 GMT
3 Connection: Keep-Alive
4 Content-Type: text/html
5 Date: Sun, 12 Jun 2011 03:39:53 GMT
6 Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
7 Content-Length: 5783
結果該頁面顯示在ISO-8859-1中,我收到一些亂碼文本。有誰知道我可以如何防止這種不良結果?謝謝。