I got the email subject using python modules and the resulting string
'=D8=B3=D9=84=D8=A7=D9=85_=DA=A9=D8=AC=D8=A7=D8=A6=DB=8C?='
I know the string is encoded in 'utf-8'. Python has a method called strings to decode such strings. But to use the method, I needed to replace the = sign with the \x sign. By manually exchanging and then printing the decoded resulting string, I get the string سلام_کجائی, which is exactly what I want. The question is, how can I make an exchange automatically? The answer seems more complicated than just using functions in strings, such as a replace function.
Below is the code I used after manual control?
r='\xD8\xB3\xD9\x84\xD8\xA7\xD9\x85_\xDA\xA9\xD8\xAC\xD8\xA7\xD8\xA6\xDB\x8C' print r.decode('utf-8')
I would be grateful for any workable idea.
source share