| 222 | | text = match.group(1) |
| 223 | | if text[0] == u'#': |
| 224 | | text = text[1:] |
| 225 | | try: |
| 226 | | if text[0] in u'xX': |
| 227 | | c = int(text[1:], 16) |
| 228 | | else: |
| 229 | | c = int(text) |
| 230 | | return unichr(c) |
| 231 | | except ValueError: |
| 232 | | return match.group(0) |
| 233 | | else: |
| 234 | | try: |
| 235 | | return unichr(name2codepoint[text]) |
| 236 | | except (ValueError, KeyError): |
| 237 | | return match.group(0) |
| | 222 | text = match.group(1) |
| | 223 | if text[0] == u'#': |
| | 224 | text = text[1:] |
| | 225 | try: |
| | 226 | if text[0] in u'xX': |
| | 227 | c = int(text[1:], 16) |
| | 228 | else: |
| | 229 | c = int(text) |
| | 230 | return unichr(c) |
| | 231 | except ValueError: |
| | 232 | return match.group(0) |
| | 233 | else: |
| | 234 | try: |
| | 235 | return unichr(name2codepoint[text]) |
| | 236 | except (ValueError, KeyError): |
| | 237 | return match.group(0) |