On Mar 24, 2007, at 10:15 PM, Chris Carlin wrote:

> Scott Dial wrote:
>
>>> 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 ;).
>
> I mean the oscar stream: does AOL send character encoding data in the
> stream?

Most of the time, yes, it does.  The tlvs[1] refers to the encoding  
'flag' of sorts.

>
> What's in tlvs[1] (from encoding = tlvs[1])?
>
>> 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 patches I have from you [1] don't seem to deal with encoding other
> than to do the right thing upon failures. It doesn't seem to provide
> access to anything extra. Am I missing something?
>
>> 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')
>
> Daniel, in guess_encoding utf-16be is commented out. Any idea why?

Because it's dumb.  ;D  (I'm half serious)  Ok, so the logic behind  
guess_encoding and the gaim stuff is to "try" the various encodings  
and see which one doesn't fail miserably.  Then go with that one.   
However, the problem I ran into is that utf-16be expects 2 bytes for  
every character.  Unfortunately, if your character string has an even  
number of characters in it, regardless of whether they are 2 byte  
utf16's or 1byte ascii, it goes "oh ok  utf-16be worked".  So anyone  
sending ascii with even number of characters got gobblygook.  Cute,  
huh?  Apparently the c libraries are much better behaved.  I couldn't  
figure out a way around this so I had to comment it out.  If you know  
of a better way.....  =)

> I ended up with some free time, so I'll take a crack at this stuff and
> hopefully have something for testing soon.

That's awesome to hear!  =)

Daniel

>
>
> ~Chris
>
>
> [1] http://b.airaim.com/oscar.diff http://b.airaim.com/scheduler.diff
> _______________________________________________
> py-transports mailing list
> py-transports@blathersource.org
> http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports

_______________________________________________
py-transports mailing list
py-transports@blathersource.org
http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports

Reply via email to