view bin/percent_encode.py @ 108:9f7a35bf07f9

one more sid fix, match java unicode escaping in path
author Henry Thompson <ht@markup.co.uk>
date Tue, 19 Sep 2023 19:28:34 +0100
parents 1daa8e444cfe
children
line wrap: on
line source

'''Handle unquoting of non-UTF-8 bytes by %-encoding them'''
import codecs

def percent_encode(ude):
  #print(ude.object,ude.object[ude.start:ude.end])
  return (''.join('%%%X'%c for c in ude.object[ude.start:ude.end]),
          ude.end)

codecs.register_error('percent',percent_encode)