[Patches] [ python-Patches-1453235 ] IDNA codec simplification

SourceForge.net noreply at sourceforge.net
Sun Mar 19 11:13:52 CET 2006


Patches item #1453235, was opened at 2006-03-18 16:52
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1453235&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Martin v. Löwis (loewis)
Summary: IDNA codec simplification

Initial Comment:
This patch simplifies the idna codec. It moves the
encode and decode functionality out of the Codec class,
so that it can be reused by the stateless and the
incremental codecs. (See patch #1436130 for the history
of this patch).

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-03-19 11:13

Message:
Logged In: YES 
user_id=21627

This patch is wrong (AFAICT). If I understand the
incremental API correctly, it should be possible to pass
chunks of the input to the incremental encoder;
concatenating the results should give the same string as if
I had passed the entire input at once. This doesn't work for
this patch:

py> u"dörwald.de".encode("idna")
'xn--drwald-wxa.de'
py> c = codecs.getincrementalencoder("idna")()
py> c.encode(u"dör")
'xn--dr-fka'
py> c.encode(u"wald.de")
'wald.de'

So in the first case, I get the (correct) result
'xn--drwald-wxa.de'; in the second case, I get the incorrect
result 'xn--dr-fkawald.de'.

To properly encode IDNA incrementally, you need to process
an entire label at a time (i.e. between two dots, 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1453235&group_id=5470


More information about the Patches mailing list