Edgewall Software

Opened 18 years ago

Closed 18 years ago

#106 closed defect (fixed)

Hexadecimal character references not handled

Reported by: hbl@… Owned by: cmlenz
Priority: major Milestone: 0.4
Component: Parsing Version: 0.3.6
Keywords: Cc:

Description

Hexadecimal character references such as "'" give rise to "ValueError?: invalid literal for int()".

Change History (2)

comment:1 Changed 18 years ago by hbl@…

  • Component changed from General to Parsing

Patch to handle hexadecimal character references:

Index: genshi/input.py
===================================================================
--- genshi/input.py     (revision 512)
+++ genshi/input.py     (working copy)
@@ -339,7 +339,10 @@
         self._enqueue(TEXT, text)

     def handle_charref(self, name):
-        text = unichr(int(name))
+        if name[0] == "x":
+            text = unichr(int(name[1:], 16))
+        else:
+            text = unichr(int(name))
         self._enqueue(TEXT, text)

     def handle_entityref(self, name):

comment:2 Changed 18 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Patch applied in [515]. Thanks a lot!

Note: See TracTickets for help on using tickets.