mega.py icon indicating copy to clipboard operation
mega.py copied to clipboard

Chinese decode problem

Open CiaShangLin opened this issue 3 years ago • 1 comments

I used the get_files() method to get all the nodes But the name of the Chinese file or folder will return unexpected text For example: I expected to get "中文資料夾" but I got "ä¸æ–‡è³‡æ–™å¤¾" Is this a base64 encoding problem? How can this be solved? Thank you

CiaShangLin avatar Mar 07 '21 13:03 CiaShangLin

For anyone wondering how to do this do the following:

b = bytes(file_name, encoding="raw_unicode_escape") actual_file_name = b.decode()

actual_file_name should be your desired string as it appears in Mega. I hope this fixes other people's problems, because this took way too long for me to figure out!

MarkFGit avatar Jun 11 '22 20:06 MarkFGit