-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Response.Content returns garbled content #2262
Comments
There is nothing wrong with getting the ContentType encoding in the header in theory, but it is invalid for utf-7. Have you considered adding a parameter to RestClientOptions to define which encodings to ignore? I hope that for ignored encoding, the default encoding utf-8 is used to output the content |
Found the problem version: net framework 4.6.2 |
RestSharp uses the value of the Another alternative is to ignore the |
The ContentType of the request header returns utf-7 encoding, but the browser does not support utf-7 encoding, so the default utf-8 encoding is used |
I use RestSharp version 112.0.0
net framework 4.6.2
Response.Content returns garbled content, but the result returned by the browser is not garbled. See the picture. The left side is the result returned by RestSharp, and the right side is the result returned by the browser source code. It is certain that the browser uses utf-8 decoding.
I analyzed the reason and I think the browser skips the utf-7 encoding, whether it is utf-7 returned in the content-type of the header or utf-7 set in the charset of the html code. I used the following code to verify it.
For this html code, the encoding obtained is utf-8. UTF-7 is not effective when it is both before and after.
The text was updated successfully, but these errors were encountered: