Hi,
I’m integrating with the Discourse API using RestSharp and running into an issue with usernames containing non-ASCII characters (specifically German umlauts). I need to impersonate a user with username foö (contains ö).
When sending the raw username in the Api-Username header, I get: Request headers must contain only ASCII characters
When URL-encoding the username (Uri.EscapeDataString("foö") → fo%C3%B), authentication fails with: {"errors":["Du bist nicht berechtigt, die angeforderte Ressource anzuzeigen. Der API-Benutzername oder -Schlüssel ist ungültig."],"error_type":"invalid_access"}(access forbidden / user not existing)
I’m using an API key with admin privileges. Endpoint: POST /posts.json to create topics on behalf of users
What’s the correct way to pass usernames with non-ASCII characters in the Api-Username header? Should I:
- Use a different encoding method?
- Use a user ID instead (if so, what header name)?
- Something else entirely?
Thanks for any guidance!