[Python-checkins] CVS: python/dist/src/Lib/lib-tk tkFileDialog.py,1.4,1.5

Martin v. L?wis loewis@users.sourceforge.net
Sun, 30 Dec 2001 06:43:58 -0800


Update of /cvsroot/python/python/dist/src/Lib/lib-tk
In directory usw-pr-cvs1:/tmp/cvs-serv17192

Modified Files:
	tkFileDialog.py 
Log Message:
Print encoded versions of the file names in test application.


Index: tkFileDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tkFileDialog.py	2001/11/08 17:51:33	1.4
--- tkFileDialog.py	2001/12/30 14:43:56	1.5
***************
*** 125,129 ****
  
  if __name__ == "__main__":
  
!     print "open", askopenfilename(filetypes=[("all filez", "*")])
!     print "saveas", asksaveasfilename()
--- 125,143 ----
  
  if __name__ == "__main__":
+     # Since the file name may contain non-ASCII characters, we need
+     # to find an encoding that likely supports the file name, and
+     # displays correctly on the terminal.
  
!     # 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 filez", "*")]).encode(enc)
!     print "saveas", asksaveasfilename().encode(enc)
!