unicode
unicode copied to clipboard
get_unihan_properties_internal raise AttributeError
When a CJK character is looked up with verbose option, AttributeError is thrown:
% ./unicode -v 夢
U+5922 CJK UNIFIED IDEOGRAPH-5922
UTF-8: e5 a4 a2 UTF-16BE: 5922 Decimal: 夢 Octal: \054442
夢
Category: Lo (Letter, Other); East Asian width: W (wide)
Unicode block: 4E00..9FFF; CJK Unified Ideographs
Bidi: L (Left-to-Right)
Traceback (most recent call last):
File "./unicode", line 1014, in <module>
main()
File "./unicode", line 1011, in main
print_characters(processed_args, options.maxcount, format_string, options.query_wikipedia, options.query_wiktionary)
File "./unicode", line 746, in print_characters
uhp = get_unihan_properties(c)
File "./unicode", line 335, in get_unihan_properties_internal
properties[key] = value.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
Env. info: macOS Big Sur version 11.2.1, MacBook Air (M1, 2020), Apple M1 Python 3.9.2
grep is placed in /usr/bin