Browse code

* s3cmd: Always output UTF-8, even on output redirects.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/branches/0.9.8.x@215 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/08/19 22:43:46
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+2008-08-19  Michal Ludvig  <michal@logix.cz>
2
+
3
+	* s3cmd: Always output UTF-8, even on output
4
+	  redirects.
5
+
1 6
 2008-08-01  Michal Ludvig  <michal@logix.cz>
2 7
 
3 8
 	* TODO: Add some items
... ...
@@ -14,6 +14,7 @@ import errno
14 14
 import pwd, grp
15 15
 import glob
16 16
 import traceback
17
+import codecs
17 18
 
18 19
 from copy import copy
19 20
 from optparse import OptionParser, Option, OptionValueError, IndentedHelpFormatter
... ...
@@ -1037,6 +1038,9 @@ if __name__ == '__main__':
1037 1037
 		from S3 import Utils
1038 1038
 		from S3.Exceptions import *
1039 1039
 
1040
+		## Output UTF-8 in all cases, even on output redirects
1041
+		sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
1042
+
1040 1043
 		main()
1041 1044
 		sys.exit(0)
1042 1045
 	except SystemExit, e: