Python's open() uses the Py_FileSystemDefaultEncoding. Py_FileSystemDefaultEncoding is NULL (bltinmodule.c) for most systems. Setlocate will set it. Thus we fixed the example and set the locale to the user defaults. Now "enc" will have a useful encoding thus the example will work with non ascii filename, e.g. with umlauts in it. open() will work with the string directly now. encode(enc) is only needed for terminal output, thus we enchanced the example to show the two uses of the returned filename string separatly. If you comment out the setlocale() you can see that open fails, which illustrates what seems to be a design flaw in tk. Tk should be able to give you a string in exactly the encoding in which the filesystem gave it to tk. 4.4.2002 Bernhard Bernhard *** ./dist/src/Lib/lib-tk/tkFileDialog.py Thu Apr 4 18:56:07 2002 --- ./lib/python2.3/lib-tk/tkFileDialog.py Thu Apr 4 20:10:51 2002 *************** *** 130,143 **** # Start off with UTF-8 enc = "utf-8" # See whether CODESET is defined try: import locale enc = locale.nl_langinfo(locale.CODESET) except (ImportError, AttributeError): pass ! print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) ! print "saveas", asksaveasfilename().encode(enc) --- 130,159 ---- # Start off with UTF-8 enc = "utf-8" + import sys # See whether CODESET is defined try: import locale + locale.setlocale(locale.LC_ALL,'') enc = locale.nl_langinfo(locale.CODESET) except (ImportError, AttributeError): pass ! # dialog for openening files ! ! openfilename=askopenfilename(filetypes=[("all files", "*")]) ! try: ! fp=open(openfilename,"r") ! fp.close() ! except: ! print "Could not open File: " ! print sys.exc_info()[1] ! ! print "open", openfilename.encode(enc) ! ! # dialog for saving files ! ! saveasfilename=asksaveasfilename() ! print "saveas", saveasfilename.encode(enc)