I tried sys.getdefaultencoding() but unfortunately that doesn't work. It returns ascii on my system which has the system locale set to ja_JP (i.e. the encoding should be Shift-JIS).
I'm trying to parse CJK text (on Windows). I need to read some text from keyboard, determine the system encoding, and convert it to utf8. I would often change my system locale between zh_CN (GBK encoding) and ja_JP (Shift-JIS encoding) so hard-coding the system encoding (encoding of keyboard-input text) is not an option. Any solutions?