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. Advertising

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. Fredrik Lundh

    Re: unicode and data strings

    Fredrik Lundh, Jan 28, 2005, in forum: Python
    Replies:
    0
    Views:
    378
    Fredrik Lundh
    Jan 28, 2005
  2. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    767
    Malcolm
    Jun 24, 2006
  3. Asterix
    Replies:
    5
    Views:
    721
    Matt Nordhoff
    Aug 31, 2008
  4. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    966
    Grzegorz ¦liwiñski
    Jan 19, 2011
  5. Chirag Mistry
    Replies:
    6
    Views:
    172
    Ollivier Robert
    Feb 8, 2008
Loading...

Share This Page