How to send special character like å in header from okhttp library

Viewed 1238

Is it possible to send special characters in headers from okhttp library? Right now my app crashes showing the following error:

java.lang.IllegalArgumentException: Unexpected char 0xe5 at 1 in username value: påfyll
                                                   at okhttp3.Headers$Builder.checkNameAndValue(Headers.java:320)

This is how i am sending the request.

okhttp3.Request request = new okhttp3.Request.Builder()
            .url(AppConfig.CONCERT_LIST)
            .addHeader("Content-Type", "application/json; charset=UTF-8")
            .addHeader("username", "påfulo")
            .addHeader("accessToken", "12345ASDFGsf98")
            .build();
2 Answers
Related