Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
535 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | from __future__ import print_function
|
---|
| 2 | import sys
|
---|
| 3 | import locale
|
---|
| 4 |
|
---|
| 5 | try:
|
---|
| 6 | reload(sys)
|
---|
| 7 | except NameError: # Python 3
|
---|
| 8 | pass
|
---|
| 9 |
|
---|
| 10 | def main():
|
---|
| 11 | encoding = locale.getdefaultlocale()[1]
|
---|
| 12 | if not encoding:
|
---|
| 13 | return False
|
---|
| 14 |
|
---|
| 15 | try:
|
---|
| 16 | sys.setdefaultencoding(encoding)
|
---|
| 17 | except AttributeError: # Python 3
|
---|
| 18 | pass
|
---|
| 19 |
|
---|
| 20 | textmap = {
|
---|
| 21 | 'cp936': u'\u4e2d\u6587',
|
---|
| 22 | 'cp1252': u'Lat\u012Bna',
|
---|
| 23 | 'cp932': u'\u306b\u307b\u3093\u3054'
|
---|
| 24 | }
|
---|
| 25 | if encoding in textmap:
|
---|
| 26 | print(textmap[encoding])
|
---|
| 27 | return True
|
---|
| 28 |
|
---|
| 29 | if __name__ == '__main__':
|
---|
| 30 | print(main())
|
---|
Note:
See
TracBrowser
for help on using the repository browser.