Enabling rails page caching causes the http header path to disappear

I need the encoding for utf-8, which is apparently the default. I recently turned on page caching for multiple static pages:

caches_page :about

Caching works fine, and I see the corresponding about.html and contact.html pages generated in my / public folder, except when the page is displayed, it is no longer in utf-8.

After I searched several times, I tried to look at the http headers with wget, before and after caching:

first time:

$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

cached:

$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

as a result, the page is displayed in ISO-8859-1, and I get a bunch of garbled text. Does anyone know how I can prevent this unwanted result? Thank.

+3
1

.

, , rails . .

apache , :

AddDefaultCharset UTF-8

, , http://www.philsergi.com/2007/06/rails-page-caching-and-mime-types.html

<LocationMatch \/(rss)\/?>
    ForceType text/xml;charset=utf-8
</LocationMatch>
<LocationMatch \/(ical)\/?>
    ForceType text/calendar;charset=utf-8
</LocationMatch>
+2

All Articles