Chris Carlin wrote:
> Daniel Henninger wrote:
>> Scott do you still have a copy of that patch?  I haven't been able to find
>> it in my email.  =(
>>
>> Daniel
>>   
> 
> The patch doesn't seem to do anything with encoding either, but it does 
> wrap the questionable part in a try so its failure won't bring down the 
> whole thing.
> 
 > Is encoding here a character encoding anyway?
 >

I'm not familiar with the rest of the workings of pyaim-t, just of the 
oscar module. I leave that part to you ;). The change I was saying that 
is relevant is that all messages come with an encoding (and my patch is 
to let you get to that for profiles). The user of the oscar module 
(pyaim-t) is responsible for decoding it if that is the right thing to 
do. So, as you said, the status.encode is forced to go through a decode 
because all of the strings from oscar are raw strings.

For refernce, my strategy for dealing with this has been attempt to use 
AIM's suggested charset and otherwise fallback to utf-16be. If AIM 
didn't provide charset with the message, I assume it is ascii.

     try:
         text = message.decode(encoding, 'replace')
     except (UnicodeDecodeError, LookupError):
         text = message.decode('utf-16be', 'replace')

AFAIK, this has not failed me once. HTH :)

-Scott

-- 
Scott Dial
[EMAIL PROTECTED]
[EMAIL PROTECTED]
_______________________________________________
py-transports mailing list
py-transports@blathersource.org
http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports

Reply via email to