comparison bin/percent_encode.py @ 85:1daa8e444cfe

work-around for weird handling of %-encoding in Java impl. of SURT
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 24 Aug 2023 18:21:41 +0100
parents
children
comparison
equal deleted inserted replaced
84:c18c307cc325 85:1daa8e444cfe
1 '''Handle unquoting of non-UTF-8 bytes by %-encoding them'''
2 import codecs
3
4 def percent_encode(ude):
5 #print(ude.object,ude.object[ude.start:ude.end])
6 return (''.join('%%%X'%c for c in ude.object[ude.start:ude.end]),
7 ude.end)
8
9 codecs.register_error('percent',percent_encode)