Ad
  • Custom User Avatar

    The complexity is 2^n. if string length is very large, this method maybe very slow

  • Custom User Avatar

    I try to convert all strings to unicode by using str.decode("utf-8") but it fails.

    I was wondering how you convert katakana?

  • Custom User Avatar

    But after I comment this line,
    There is no UnicodeEncodeError.

    Problem happens on katakana
    And I use chardet.detect to detect the code infomartion, the result is 'utf-8'
    So I think decode("utf-8") is correct?

  • Custom User Avatar

    I try to transfer code to "unicode" by:
    key = key.decode("utf-8")
    the result is
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

    But it work well on my computer. with python 2.7.
    Does anyone know why?