Bug 59565 - Apache 2.4.20 AddDefaultCharset doesn't work
Summary: Apache 2.4.20 AddDefaultCharset doesn't work
Status: NEEDINFO
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.20
Hardware: PC Solaris
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-17 21:09 UTC by joeborge
Modified: 2016-06-17 21:56 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description joeborge 2016-05-17 21:09:18 UTC
When I was using Apache 2.2, "AddDefaultCharset" in httpd.conf can make the default character set to work.

When upgrading to Apache 2..4.20, it no longer works. I had to add "ForceType" to vhosts before the web pages will show the charset correctly.

However, ForceType also breaks the file downloading. Any types of files will show in the browsers (mp3, pdf, ppt, doc, ..., etc.). Once ForceType is turned off, file downloading will work with appropriate applications.

I tried to change the DEFAULT_ADD_DEFAULT_CHARSET_NAME in include/httpd.conf and recompiled but it didn't help.

Since haven't found any one reporting this, I am curious if this could be a bug in the code.

This has nothing to do with php. Just plan html files.
I even tried the <meta http-equiv="content-type" content="text/html; charset=xxxx"> in html files but that didn't help either.

Anyone saw this before?
Comment 1 Eric Covener 2016-06-17 19:55:55 UTC
"major" seems like a bit much.  Can you share some basic request/response headers?
Comment 2 joeborge 2016-06-17 21:56:07 UTC
Here is the header from one of the virtual hosts (chung-shan.hsiao.net):

HTTP/1.1 200 OK => 
Date => Fri, 17 Jun 2016 21:50:57 GMT
Server => Apache/2.4.20 (Unix) OpenSSL/1.0.1m SVN/1.9.4 PHP/5.6.20
Last-Modified => Sat, 31 Oct 2015 17:58:37 GMT
ETag => "a66-5236a4b19aa98"
Accept-Ranges => bytes
Content-Length => 2662
Cache-Control => max-age=0
Expires => Fri, 17 Jun 2016 21:50:57 GMT
Connection => close
Content-Type => text/html; charset=big5

I used "http://www.webconfs.com/http-header-check.php" to check the http header.
This is when the virtual server has the following settings:

    AddDefaultCharset big5
    ForceType text/html

When I comment out "ForceType text/html", the header becomes:


HTTP/1.1 200 OK => 
Date => Fri, 17 Jun 2016 21:54:09 GMT
Server => Apache/2.4.20 (Unix) OpenSSL/1.0.1m SVN/1.9.4 PHP/5.6.20
X-Powered-By => PHP/5.6.20
Cache-Control => max-age=0
Expires => Fri, 17 Jun 2016 21:54:09 GMT
Content-Length => 2662
Connection => close
Content-Type => text/html; charset=UTF-8

charset becomes UTF-8 even with "AddDefaultCharset big5" set.

Apache 2.2.x didn't seem to have this issue.