Reading path strings from a file, the file contains strings like this which have escaped special unicode characters: /WAY-ALPHA2019-Espan\314\203ol-Episodio-01.mp4
I need to convert that string of characters into this:
/WAY-ALPHA2019-Español-Episodio-01.mp4
Here is some code demonstrating what I am trying to do:
>>> stringa = r'/WAY-ALPHA2019-Espan\314\203ol-Episodio-01.mp4'
>>> stringb = b'/WAY-ALPHA2019-Espan\314\203ol-Episodio-01.mp4'
>>> print(stringa)
/WAY-ALPHA2019-Espan\314\203ol-Episodio-01.mp4
>>> print(stringb)
b'/WAY-ALPHA2019-Espan\xcc\x83ol-Episodio-01.mp4'
>>> print(stringa.decode('utf8'))
Traceback (most recent call last):
File "C:\Users\arlin\AppData\Local\Programs\Python\Python310-32\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
>>> print(stringb.decode('utf8'))
/WAY-ALPHA2019-Español-Episodio-01.mp4