-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (21 loc) · 707 Bytes
/
main.py
File metadata and controls
21 lines (21 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import chardet
import locale
bbb = '【】'
print sys.getdefaultencoding()
print sys.stdin.encoding
print sys.stdout.encoding
print locale.getdefaultlocale()
print (locale.getpreferredencoding())
print (sys.getfilesystemencoding())
print chardet.detect(bbb)['encoding']
print chardet.detect(bbb)
print bbb.decode(chardet.detect(bbb)['encoding']).encode(sys.stdin.encoding)
for filename in os.listdir('tmp'):
print chardet.detect(filename)['encoding']
print filename.decode(sys.getfilesystemencoding()).encode(sys.stdout.encoding)
# print filename.decode(chardet.detect(filename)['encoding']).encode(sys.stdout.encoding)
print 'xxx'