I'm trying to get the shift-jis character code from a unicode string. I'm not really that knowledgable in python, but here is what I have tried so far:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from struct import *
data="臍"
udata=data.decode("utf-8")
data=udata.encode("shift-jis").decode("shift-jis")
code=unpack(data, "Q")
print code
But I get an UnicodeEncodeError: 'ascii' codec can't encode character u'\u81cd' in position 0: ordinal not in range(128) error.
The string is always a single character.
That character is represented in shift-jis as the two byte sequence 0xE4 and 0x60:
So
'\xe4\x60'isu'\u81cd'encoded as shift-jis.