bpo-34198: Additional encoding options to tkinter.filedialog by naritotakizawa · Pull Request #8429 · python/cpython

These call builtin open, but don't have encoding args.

  • askopenfile
  • askopenfiles
  • asksaveasfile

In many Windows environments it will write as follows:

file_path = filedialog.askopenfilename()
file = open(file_path, 'r', encoding='utf-8')
print(file.read())

I want to write as follows:

file = filedialog.askopenfile('r', encoding='utf-8')
print(file.read())

https://bugs.python.org/issue34198