My program gives me a dictionary which has utf8 encoded keys. I am dumping this dictionary to a file using json module. In the json file keys are printed in utf8 format. Key-Values are actually letters of Bengali language. I got the expected output in a ubuntu-16.04 machine but the problem is in a ubuntu-20.04 machine. There are some extra English characters after the key-values(Bengali Words).The output in ubuntu-20.04 is like this:
{
"1": "অপরিবর্তিত\n\f",
"2": "প্রশিক্ষণ\n\f"
}
But I need like this:
{
"1": "অপরিবর্তিত",
"2": "প্রশিক্ষণ"
}
To dump json I am using the following code:
with codecs.open('File.json', 'w', encoding='utf8') as output:
json.dump(mainDic, output, indent = 4, ensure_ascii=False)
Please help me.