HTTP header custom value - attempt to pass umlaut characters

I am using Node.js and Express.js 3.x.

As one of our authorization headers, we pass the username. Some of our usernames contain umlaut characters: ü ö ä and the like. For usernames with "normal" characters, everything works fine. But when jörg tries to make a request, the server does not recognize the umlaut symbol in the header.

Trying to mimic problem I:

  • Some tests have been created that set the username header with the umlaut symbol. These tests pass, they can pass correctly in umlaut.
  • The extensions "postman" and "advanced rest client" Chrome used and made a request manually on the server - in this case it failed. I saw that the server cannot recognize the umlaut symbol, does it interpret it as a kind ? .

Is there a restriction on custom HTTP header character values ​​that prohibit the use of these characters? Any idea why this will work in tests, but not from my browser extension? Am I forgetting to set a character set somewhere?

+1
character-encoding diacritics express
source share
1 answer

A summary of what was written in another related question and in the comments:

  • You can put any 'printable' ASCII char in the custom header field field.
  • If you want to use special characters, encode these characters, following any rules / encoding / encoding that you choose. As long as this encoding uses simple ASCII characters, this is normal. An example is the use of UTF-8 and the encoding of string characters in \ u %%.
  • On the server side - you should manually understand the meaning of the encoded string, perhaps by decoding it using the character set / encoding paradigm rules that you selected earlier.
+1
source

All Articles