Unicode usernames

Thank you, Michael Brown.

I have tested it and if I test it in the browser it is ok, but in the programming software it is not ok, because the rule is that only ascii can be used to transfer this protocol.

Reason for the error:

TypeError: Invalid character in header content [“Api-Username”]

Please refer to the log, it is recommended to add ut8 encoding or decoding once for matching

  1. Test interface

2.web address

https://xxxxxxxx/posts.json

Accept:application/json
api-key:f9c13aafa9b21baf778161bff66a62533ba650b6e4542e3e9788e98c55ded869
Api-Username:system

Test results:

OK

Accept:application/json
api-key:f9c13aafa9b21baf778161bff66a62533ba650b6e4542e3e9788e98c55ded869
Api-Username:风之旅人

{“status”:500,“error”:“Internal Server Error”}

Accept:application/json
api-key:f9c13aafa9b21baf778161bff66a62533ba650b6e4542e3e9788e98c55ded869
Api-Username:%E8%BF%90%E6%80%9D

You are not permitted to view the requested resource. The API username or key is invalid

Reason for error:

The use of Chinese in the header is invalid, it needs to be encoded by encodeURI() in order to be transmitted to the server, but the server needs to decode decodeURI() in order to recognize it.

Suggest to add a judgment, if not found, try to decodeURI, match the username.