I have the following str
:
"\xd0\xa0\xd0\xb0\xd1\x81\xd1\x88\xd0\xb8\xd1\x84\xd1\x80\xd0\xbe\xd0\xb2\xd0\xba\xd0\xb0_RootKit.com_63k.txt"
This comes from a filename: Расшифровка_RootKit.com_63k.txt
My problem is a cannot reverse the first str
to the second one. I have tried a few things, using en/decode()
, bytes()
, etc but I did not manage.
One thing I noticed was b'' and bytes() have different outputs:
path = "\xd0\xa0\xd0\xb0\xd1\x81\xd1\x88\xd0\xb8\xd1\x84\xd1\x80\xd0\xbe\xd0\xb2\xd0\xba\xd0\xb0_RootKit.com_63k.txt"
bpath = bytes(path, "UTF-8")
print(bpath.decode("UTF-8"))
print(b"\xd0\xa0\xd0\xb0\xd1\x81\xd1\x88\xd0\xb8\xd1\x84\xd1\x80\xd0\xbe\xd0\xb2\xd0\xba\xd0\xb0_RootKit.com_63k.txt".decode('utf8'))
Results:
РаÑÑиÑ
Ñовка_RootKit.com_63k.txt
Расшифровка_RootKit.com_63k.txt
So I wonder what is the difference between b''
and bytes()
; maybe it will help me solving my problem !