[utils] Fix "write_json_file" for unicode names in python 2.x (fixes #4125)