zhuowei/RaspberryJuice

Cjk characters not supported by Python API

Closed this issue · 2 comments

Hi
Strings are encoded to cp437, but it failed to encode all characters. Do we have to use cp437 here?

    Traceback (most recent call last):
    File "test1.py", line 10, in <module>
      mc.postToChat("の")
    File "D:\code\sandbox-docker\Setup\mcpi\minecraft.py", line 241, in postToChat
      self.conn.send(b"chat.post", msg)
    File "D:\code\sandbox-docker\Setup\mcpi\connection.py", line 39, in send
      s = b"".join([f, b"(", flatten_parameters_to_bytestring(data), b")", b"\n"])
    File "D:\code\sandbox-docker\Setup\mcpi\util.py", line 10, in flatten_parameters_to_bytestring
      return b",".join(map(_misc_to_bytes, flatten(l)))
    File "D:\code\sandbox-docker\Setup\mcpi\util.py", line 18, in _misc_to_bytes
      return str(m).encode("cp437")
    File "D:\Python34\lib\encodings\cp437.py", line 12, in encode
      return codecs.charmap_encode(input,errors,encoding_map)
    UnicodeEncodeError: 'charmap' codec can't encode character '\u306e' in position 0: character maps to <undefined>

Does your pull request #68 solve this issue?

resolved in v1.12