Your problem is almost certainly that a and b are two different Unicode values with the same normalization. As a simple example, consider these two ways to display é:
>>> b'e\xcc\x81'.decode()
'é'
>>> b'\xc3\xa9'.decode()
'é'
The first is a two-character string consisting of e (U+0065) and the combining diacrtical mark ´ (U+0301). The second is a single character consisting of é (U+00E9).
In order to compare them successfully, you need to normalize them. There are several different normalizations available, though which one you use doesn't matter much for comparison purposes as long as you use the same one for each.
>>> import unicodedata
>>> x = b'e\xcc\x81'.decode()
>>> y = b'\xc3\xa9'.decode()
>>> x == y
False
>>> unicodedata.normalize("NFC", x) == unicodedata.normalize("NFC", y)
True
Normalization NFC, for example, normalizes by replacing U+0065/U+0301 with U+00E9. For more information, see https://www.unicode.org/faq/normalization.html. You will probably want to normalize any user input before storing it, and you'll want to make sure that the same normalization is used for all stored data. The FAQ may help you decide which normalization is most appropriate for your use.
print(a)andprint(b)?person.categoryandto_delete.a.encode()andb.encode()b'e\xcc\x81'.decode()andb'\xc3\xa9'.decode(). Both look likeé, but they are two different Unicode strings.