Minor bug fix

This commit is contained in:
Miroslav Stampar
2025-11-06 11:14:13 +01:00
parent 03be59042f
commit 0599f7c1b6
3 changed files with 4 additions and 4 deletions

View File

@@ -316,7 +316,7 @@ def getBytes(value, encoding=None, errors="strict", unsafe=True):
retVal = value.encode(encoding, errors)
if unsafe:
retVal = re.sub(r"%s([0-9a-f]{2})" % SAFE_HEX_MARKER, lambda _: decodeHex(_.group(1)), retVal)
retVal = re.sub((r"%s([0-9a-f]{2})" % SAFE_HEX_MARKER).encode(), lambda _: decodeHex(_.group(1)), retVal)
else:
try:
retVal = value.encode(encoding, errors)