0

What is the right encoding/charset in nginx configuration file to display accentuated characters in HTTP authentication message ?

For example, this conf file :

server {
...
    location / {
        auth_basic           "Zone sécurisée";
        auth_basic_user_file .htpasswd;
    }
}

Is displaying in Firefox' prompt window :

"Zone sécurisée"

No real solution or explanation found on the web. I tried to replace é in conf file by é, by &, by &#233, by =C3=A9 or adding charset utf-8 directive or =?UTF-8? at the beginning of the string but nothing works !

Official nginx doc, talking about a "string" without more explanation about encoding of accentuated characters.

NB : I have no problem with similar .htaccess file for Apache

Klemart3D
  • 1
  • 3

1 Answers1

1

RFC 7617 Section 3

The 'realm' parameter carries data that can be considered textual; however, `[RFC7235] does not define a way to reliably transport non- US-ASCII characters. This is a known issue that would need to be addressed in a revision to that specification.

realm parameter is the string you put in auth_basic directive. So, can't suggest anything, but stick to ASCII.

Alexey Ten
  • 8,435
  • 1
  • 34
  • 36