[Lxml-checkins] r32115 - lxml/trunk/src/lxml

scoder at codespeak.net scoder at codespeak.net
Sat Sep 9 20:49:06 CEST 2006


Author: scoder
Date: Sat Sep  9 20:49:03 2006
New Revision: 32115

Modified:
   lxml/trunk/src/lxml/parser.pxi
Log:
fixed URL recoding in _parser_resolve_from_python(): no recoding for user originating URLs, UTF-8 for everything else

Modified: lxml/trunk/src/lxml/parser.pxi
==============================================================================
--- lxml/trunk/src/lxml/parser.pxi	(original)
+++ lxml/trunk/src/lxml/parser.pxi	Sat Sep  9 20:49:03 2006
@@ -271,12 +271,16 @@
     try:
         if c_url is NULL:
             url = None
+        elif c_context.myDoc is NULL or c_context.myDoc.URL is NULL:
+            # parsing a main document, so URL was passed verbatimly by user
+            url = c_url
         else:
+            # parsing a related document (DTD etc.) => UTF-8 encoded URL
             url = funicode(c_url)
         if c_pubid is NULL:
             pubid = None
         else:
-            pubid = funicode(c_pubid)
+            pubid = funicode(c_pubid) # always UTF-8
 
         doc_ref = context._resolvers.resolve(url, pubid, context)
         if doc_ref is None:


More information about the lxml-checkins mailing list