Reputation: 2330
When I post a string "\u062c\u0646\u062f\u064a\u0651\u0627"
via an HTTP request it is received as the following '\\u062c\\u0646\\u062f\\u064a\\u0651\\u0627'
. What are the extra backslashes added for? And how to strip them?
Upvotes: 1
Views: 226
Reputation: 30218
… how to strip them?
s_sent = "\u062c\u0646\u062f\u064a\u0651\u0627"
s_received = '\\u062c\\u0646\\u062f\\u064a\\u0651\\u0627'
s_sent == s_received.encode().decode('unicode-escape')
True
Upvotes: 1