Bug 41529 - Accept BOM in .htaccess
Summary: Accept BOM in .htaccess
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.5-HEAD
Hardware: All Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2007-02-02 10:19 UTC by Charles A. Landemaine
Modified: 2007-09-27 00:09 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Charles A. Landemaine 2007-02-02 10:19:31 UTC
If you save the .htaccess file using ISO-8859-1 or Windows 1252 encodings, it 
works fine. But if you use utf-8 recommended and universal encoding, Apache 
triggers an "Internal Server Error". I have tried several hours creating some 
rules, and when I found out nothing worked, all of the sudden I saw Apache did 
not accept utf-8. Most operating systems and applications are migrating to utf-
8 to support international languages, so it would be a good thing to work 
properly with utf-8.
Comment 1 Nick Kew 2007-02-02 13:55:11 UTC
That'll be a BOM, inserted by your editor.  I'm not convinced we gain anything
by accepting a BOM in .htaccess files, but I'll leave it open as an enhancement

You might want to submit a bug report to the developers of your editor, if it
inserts binary stuff in a text file without telling you.

Comment 2 William A. Rowe Jr. 2007-02-26 00:45:12 UTC
I thought I had hacked ap_popen/read eons ago to address this, wonder
if it fell off the map, or I'm misremembering.  I'll take a peek.
Comment 3 William A. Rowe Jr. 2007-02-26 01:03:52 UTC

This was done for Win32 script shebang parsing, since httpd has a rule to ignore
leading whitespace, I don't see why avoiding these first three bytes would be
a bad thing for conf file parsing (minimal overhead).

That PR was 16687, see

Comment 4 William A. Rowe Jr. 2007-09-27 00:09:02 UTC
Whoops, wrong patch, the patch in the above comment relates to CGI (and could be
applied to perl python and possibly other environments when on unix.)

The patch you wanted was;


and is wrapped in an #ifdef WIN32 that is easily stripped off to apply to any
platform at all.

By rights this is a dup of 10125, but you are asking across platforms.