Encoding settings not used (FIXED)

getpreferredencoding() returns default system encoding, not default encoding for selected locale.
Current encoding settings are in getlocale() - see commit comments for example.

locale.setlocale(locale.LC_ALL,'') at the beginning sets locale to user-default (http://docs.python.org/2/library/locale.html)