Unicode Decode Error

"Andreas Plachy" <[email protected]>
Newsgroups gmane.mail.spam.tmda.user
Message-ID <32388F8FDC344740947D87A3E453FE6F115B2A@outsrv4.local.outsourced.com>
Hi all!

We got often problems with spammails, which have special characters in
the header.
The tmda-cgi is still unaseable, till I delete the pending file or
remove the specials chars in it.

What we have to change to bypass this unicode error?

In this expamle the "From"-field looks like this: "From: Viagra.com Inc
® <[email protected]>"

Hope someone needs an answer...

so long,
Andreas




UnicodeDecodeError Python 2.3.4: /usr/bin/python
Wed Sep 5 07:17:50 2007 

A problem occurred in a Python script. Here is the sequence of function
calls leading up to the error, in the order they occurred.

 /usr/src/tmda-cgi-0.13/tmda-cgi.py  
  188   elif Cmd == "pending":
 
  189     import PendList
 
  190     Call(PendList)
 
  191   elif Cmd == "restore":
 
  192     pass
 
Call = <function Call>, PendList = <module 'PendList' from
'/usr/src/tmda-cgi-0.13/PendList.pyc'> 


 /usr/src/tmda-cgi-0.13/tmda-cgi.py in Call(Library=<module 'PendList'
from '/usr/src/tmda-cgi-0.13/PendList.pyc'>, Str=None) 
   86     Library.Show(Str)
 
   87   else:
 
   88     Library.Show()
 
   89 
 
   90 # Capture WebUID
 
Library = <module 'PendList' from
'/usr/src/tmda-cgi-0.13/PendList.pyc'>, Library.Show = <function Show> 


 /usr/src/tmda-cgi-0.13/PendList.py in Show() 
  498               value += Unicode.TranslateToUTF8(CharSet,
decoded[0], "ignore")
 
  499           else:
 
  500             value += Unicode.TranslateToUTF8(CharSet, decoded[0],
"ignore")
 
  501         From = value
 
  502         Temp = Address.search(From)
 
value = '', global Unicode = <module 'Unicode' from
'/usr/src/tmda-cgi-0.13/Unicode.pyc'>, Unicode.TranslateToUTF8 =
<function TranslateToUTF8>, CharSet = 'us-ascii"', decoded =
('Viagra.com Inc \xae <[email protected]>', None) 


 /usr/src/tmda-cgi-0.13/Unicode.py in
TranslateToUTF8(CharSet='us-ascii"', Str='Viagra.com Inc \xae
<[email protected]>', Errors='ignore') 
  113     Uni = Decoder(Str, errors = Errors)[0]
 
  114   except:
 
  115     Uni = Decoder(Str)[0]
 
  116 
 
  117   # Encode for UTF-8
 
Uni undefined, Decoder = <built-in function ascii_decode>, Str =
'Viagra.com Inc \xae <[email protected]>' 


UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 15:
ordinal not in range(128) 
      args = ('ascii', 'Viagra.com Inc \xae <[email protected]>', 15, 16,
'ordinal not in range(128)') 
      encoding = 'ascii' 
      end = 16 
      object = 'Viagra.com Inc \xae <[email protected]>' 
      reason = 'ordinal not in range(128)' 
      start = 15
smime.p7s (application/x-pkcs7-signature, 2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.