I have a string of unprinted characters. I need to send it to the server. The problem is that in the "raw" form you will not convey the drain (there may be special characters in it). I do urlquote
. But urlquote
does not work with Unicode, and it replaces all non-printed characters, as a result of which a distorted string comes to the server. How can I make the initial line come to the server?
I want to do this: take a line and convert it so that the new line will contain character codes, for example, the new line may look like this - "\xfa\xdd\x99..."
. The question is how to get such a string? Tried the packet struct.pack
, did not work.
I will add. The initial task is to transfer buffer bytes to the server, which I convert to a string and transmit in a GET request. Perhaps there is an alternative solution.