Apache Unicode AuthName strings?
I added a username and password for a basic authentication on Apache, and I want to have Unicode AuthName strings to my users. My httpd.conf looks like this:
<Location "/"> AuthType Basic AuthName "Some Unicode Here" AuthUserFile /somewhere/htpasswd Require valid-user </Location>
Some Unicode Here” always appears to be garbage in my browser. How do I make it appear properly?
You may not be able to make it work, lack of browser support is the main issue, see What character encoding should I use for a HTTP header?.
AuthName appears as the realm in the
WWW-Authenticate: Basic realm="Some Unicode Here"
Some quick experimentation shows:
- Apache does not encode a UTF-8
AuthNamestring in the config, it sends it as-is
- Firefox, MSIE and Chrome all (correctly) interpret that UTF-8 byte sequence as ISO-8859-1 (and hence likely display it incorrectly)
- none support RFC-2047 MIME encoding as stated by HTTP RFC-2616, the display it literally as
mod_auth_tkt as cookie-based a replacement for basic auth if you have the option, it has a drop-in htpasswd style perl script, and sets
REMOTE_USER, you just need to roll your own form.)
Answered By – mr.spuratic