The answers above suggest that UTF8 encoding can be used safely - it is specifically designed for Windows.
The standard Windows console uses the coding CP850 and not utf-8, so if you try to use the source file encoded in utf8, you will get these 2 (incorrect) characters ┬░ instead of degree ° .
Demo (using python 2.7 in windows console):
deg = u'\xb0` # utf code for degree print deg.encode('utf8')
effectively outputs ┬░ .
Fix: just force the correct encoding (or better use unicode):
local_encoding = 'cp850' # adapt for other encodings deg = u'\xb0'.encode(local_encoding) print deg
or if you use a source file that explicitly defines the encoding:
# -*- coding: utf-8 -*- local_encoding = 'cp850'
Serge Ballesta Jun 07 '16 at 11:46 on 2016-06-07 11:46
source share