| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # Copyright 2012 The LUCI Authors. All rights reserved. | 3 # Copyright 2012 The LUCI Authors. All rights reserved. |
| 4 # Use of this source code is governed by the Apache v2.0 license that can be | 4 # Use of this source code is governed under the Apache License, Version 2.0 |
| 5 # found in the LICENSE file. | 5 # that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 | 9 |
| 10 def main(): | 10 def main(): |
| 11 """Creates a file name with whitespaces and comma in it.""" | 11 """Creates a file name with whitespaces and comma in it.""" |
| 12 # We could test ?><:*|"' and chr(1 to 32) on linux. | 12 # We could test ?><:*|"' and chr(1 to 32) on linux. |
| 13 # We could test ?<>*|"' on OSX. | 13 # We could test ?<>*|"' on OSX. |
| 14 # On Windows, skip the Chinese characters for now as the log parsing code is | 14 # On Windows, skip the Chinese characters for now as the log parsing code is |
| 15 # using the current code page to generate the log. | 15 # using the current code page to generate the log. |
| 16 if sys.platform == 'win32': | 16 if sys.platform == 'win32': |
| 17 filename = u'foo, bar, ~p#o,,ué^t%t .txt' | 17 filename = u'foo, bar, ~p#o,,ué^t%t .txt' |
| 18 else: | 18 else: |
| 19 filename = u'foo, bar, ~p#o,,ué^t%t 和平.txt' | 19 filename = u'foo, bar, ~p#o,,ué^t%t 和平.txt' |
| 20 with open(filename, 'w') as f: | 20 with open(filename, 'w') as f: |
| 21 f.write('Bingo!') | 21 f.write('Bingo!') |
| 22 return 0 | 22 return 0 |
| 23 | 23 |
| 24 | 24 |
| 25 if __name__ == '__main__': | 25 if __name__ == '__main__': |
| 26 sys.exit(main()) | 26 sys.exit(main()) |
| OLD | NEW |