How to change UserAgent encoding in HttpWebRequest?

Today I ran into a UserAgent encoding issue when I tried to use HttpWebRequest to send a request.

Usually UserAgent consists of latin letters and punctuation marks. However, I need to simulate the web requests of an iOS application in which the UA contains some Unicode characters (especially Chinese).

Using Fiddler to receive a raw request, I found that the application used Unicode encoding in its UA. I could not send it to C #; I got this error:

You cannot send Unicode to UserAgent. But it is really important for my project. Now I can simulate an application request without UA bytes.

How can I change UA encoding?

+5
source share
1

(rfc 2616 (http/1.1), . 2.2, 3.8. 14.43 rfc 2047 (mime, 3), sec 4, 5), - , iso-8859-1 HTTP, user-agent.

rfc 2047 unicode 8859-1; , unicode .

:

User-Agent: Million-€-Browser User-Agent: =?utf-8?q?Million-=e2=82=ac-Browser?=, e2 82 ac utf-8 .

+2

All Articles