Skip to content

Commit c64a5d8

Browse files
cclaussrefack
authored andcommitted
test: add test-charmap.py fixture
nodejs/node-gyp#1335 Reviewed-By: Refael Ackermann <[email protected]>
1 parent 22eecf3 commit c64a5d8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/fixtures/test-charmap.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from __future__ import print_function
2+
import sys
3+
import locale
4+
5+
def main():
6+
encoding = locale.getdefaultlocale()[1]
7+
if not encoding:
8+
return False
9+
10+
sys.setdefaultencoding(encoding)
11+
textmap = {
12+
'cp936': u'\u4e2d\u6587',
13+
'cp1252': u'Lat\u012Bna',
14+
'cp932': u'\u306b\u307b\u3093\u3054'
15+
}
16+
if encoding in textmap:
17+
print(textmap[encoding])
18+
return True
19+
20+
if __name__ == '__main__':
21+
print(main())

0 commit comments

Comments
 (0)