unicode and data strings

Discussion in 'Python' started by Laszlo Zsolt Nagy, Jan 28, 2005.

  1. Hello

    I have a program where I would like to calculate a checksum. Looks like
    this:

    n = self.__calc_n(seed1,seed2,pwd)

    This is required for an OTP (One Time Password) algorithm. My code was
    working before without problems.
    Now I installed Python 2.3.4 and wxPython 2.5.3 (with unicode support).
    I'm getting this exception:

    exceptions.UnicodeDecodeError:'ascii' codec can't decode byte 0x91 in
    position 0: ordinal not in range(128)

    The I tried this:

    >>>'\x91'.decode('utf8')

    UnicodeDecodeError: 'utf8' codec can't decode byte 0x91 in position 0:
    unexpected code byte

    Here is the question: I would like to use simple binary data strings
    (like an array of bytes).
    I do not care about encodings. How do I do that?

    Thanks,

    Laci 2.0
     
    Laszlo Zsolt Nagy, Jan 28, 2005
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rune Froysa

    Unicode and exception strings

    Rune Froysa, Jan 9, 2004, in forum: Python
    Replies:
    7
    Views:
    1,225
    Terry Carroll
    Jan 14, 2004
  2. Laurent Therond

    Binary strings, unicode and encodings

    Laurent Therond, Jan 15, 2004, in forum: Python
    Replies:
    11
    Views:
    848
    Serge Orlov
    Jan 17, 2004
  3. Jacob Friis

    unicode and strings

    Jacob Friis, Nov 2, 2004, in forum: Python
    Replies:
    1
    Views:
    357
    Diez B. Roggisch
    Nov 3, 2004
  4. Fuzzyman
    Replies:
    2
    Views:
    612
    Fuzzyman
    Jan 31, 2006
  5. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    1,088
    Malcolm
    Jun 24, 2006
  6. Asterix
    Replies:
    5
    Views:
    964
    Matt Nordhoff
    Aug 31, 2008
  7. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    1,331
    Grzegorz ¦liwiñski
    Jan 19, 2011
  8. Chirag Mistry
    Replies:
    6
    Views:
    376
    Ollivier Robert
    Feb 8, 2008
Loading...