An error occurred while processing a path containing Japanese on Windows. UnicodeDecodeError occurs even though the character code is Shift-JIS.
Wasn't Windows Shift-JIS?
When I looked it up, it said that "Windows is CP932, which is an extension of Shift-JIS." So, when I specified the character code to CP932, it worked smoothly.
cp932_test.py
# -*- coding: utf-8 -*-
s = '①②③④' # Shift-Characters in CP932, not in JIS
su = unicode(s, 'utf-8')
print su.encode('cp932')
print su.encode('shift-jis') #Get UnicodeEncodeError
Recognize that Shift-JIS in Windows is "CP932". Otherwise, you will be addicted to it.
Recommended Posts