Edgewall Software

Ticket #106 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

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()".

Attachments

Change History

Changed 8 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):

Changed 8 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

Patch applied in [515]. Thanks a lot!

Add/Change #106 (Hexadecimal character references not handled)

Author


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


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.