Edgewall Software

Opened 11 years ago

Closed 11 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:


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

Attachments (0)

Change History (2)

comment:1 Changed 11 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 11 years ago by cmlenz

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

Patch applied in [515]. Thanks a lot!

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain cmlenz.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.