Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:06:25+00:00 2026-05-23T08:06:25+00:00

I need charset to be utf-8, which seem to be the case by default.

  • 0

I need charset to be utf-8, which seem to be the case by default. Recently I enabled page caching for a few static pages:

caches_page :about

The caching works fine, and I see the corresponding about.html and contact.html pages generated in my /public folder, except when the page renders, it’s no longer in utf-8.

After googling for a bit I tried looking 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 displays in ISO-8859-1 and I get a bunch of garbled text. Does anyone know how I can prevent this undesirable result? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:06:25+00:00Added an answer on May 23, 2026 at 8:06 am

    The solution will depend on the server used.

    When you use page cache, the servers reads the server directly, so the rails stack does not provide encoding information to the server. Then the server default apply.

    If you’re using apache with passenger, add to the configuration:

    AddDefaultCharset UTF-8
    

    If you need specific charsets, use a solution like the one in 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>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the login page: http://www.ifreewind.net/iFreeWind.aspx I need content of this page which need
Hi I have a scenario where I need to convert the default Charset should
I need to add the charset=utf-8 at the end of the script tags to
I have a javascript code which loads some advertising code: <script type=text/javascript language=javascript charset=utf-8
when you have a charset different of UTF-8 and you need to put it
Need to insert selected text on the page into textarea. There must be some
need to add a 2nd css stylesheet to a page. do i add a
I have a document which has a nested frameset. I need to access one
I am working in simple application in which I need to post data to
I need to obtain delivery tracking details from the Canada Post website, which does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.