decode overwrite variable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jammer

    #1

    decode overwrite variable?

    Will a failed decode overwrite the variable?

    message = message.decode( 'iso-8859-1')
    or do I need to do
    msg = message.decode( 'iso-8859-1')
  • Marc 'BlackJack' Rintsch

    #2
    Re: decode overwrite variable?

    In <21235$45bd8f83 $d8a87c2a$18298 @NEXICOM.NET>, Jammer wrote:
    Will a failed decode overwrite the variable?
    >
    message = message.decode( 'iso-8859-1')
    or do I need to do
    msg = message.decode( 'iso-8859-1')
    Why don't you just try?

    In [2]: a = u'\u2022'

    In [3]: a = a.decode('iso-8859-1')
    ---------------------------------------------------------------------------
    exceptions.Unic odeEncodeError Traceback (most recent call last)

    /home/marc/<ipython console>

    UnicodeEncodeEr ror: 'ascii' codec can't encode character u'\u2022' in position 0: ordinal not in range(128)

    In [4]: a
    Out[4]: u'\u2022'

    Ciao,
    Marc 'BlackJack' Rintsch

    Comment

    Working...