FamilyGroup Report crash
Python's sort routine gratuitously converts the bytearrays returned by ICU::Collator::getByteArray to a string when storing it. This resulted in a TypeError when attempting to compare a just-returned bytearray with a stored string. We work around this by converting the bytearray into its hexadecimal representation and then decoding that into a string. Fixes #10077.
This commit is contained in:
parent
a63e0c2e23
commit
19adb31b0e
@ -33,6 +33,7 @@ import codecs
|
||||
import locale
|
||||
import collections
|
||||
import logging
|
||||
from binascii import hexlify
|
||||
|
||||
LOG = logging.getLogger("." + __name__)
|
||||
LOG.propagate = True
|
||||
@ -920,8 +921,9 @@ class GrampsLocale:
|
||||
"""
|
||||
|
||||
if HAVE_ICU and self.collator:
|
||||
#ICU can digest strings and unicode
|
||||
return self.collator.getCollationKey(string).getByteArray()
|
||||
# ICU can digest strings and unicode
|
||||
# Use hexlify() as to make a consistent string, fixing bug #10077
|
||||
return hexlify(self.collator.getCollationKey(string).getByteArray()).decode()
|
||||
else:
|
||||
if isinstance(string, bytes):
|
||||
string = string.decode("utf-8", "replace")
|
||||
|
Loading…
Reference in New Issue
Block a user