why are strings encoded in utf-8 if the default encoding is ascii? - python -
in python, when import sys
, type:
>>> sys.getdefaultencoding() >>> 'ascii'
why string automatically encoded utf-8?
>>> = 'ö' >>> >>> '\xc3\xb6'
because input provided python was
= ' ö ' \x61\x20\x3d\x20\x27\xc3\xb6\x27
you told a
contain byte sequence "\xc3\xb6"
putting 2 bytes between quotes in console input, , does.
Comments
Post a Comment