Cymru whois expert: handle strange ASN symbols better #2132
Labels
bug
Indicates an unexpected problem or unintended behavior
component: bots
help wanted
Indicates that a maintainer wants help on an issue or pull request
I discovered a slight issue with the Cymru whois expert bot with some strange AS names. For instance, AS266522.
\226\128\143
, in unicode, decodes to u+200f, the right-to-left mark. When the IMQ bot attempts to decode it withresult['as_name'] = items[4].encode('latin1').decode('utf8')
, it runs into this issue:UnicodeEncodeError: 'latin-1' codec can't encode character '\u200f' in position 42: ordinal not in range(256)
A solution which just permits decoding special symbols like RTL marks might not be the best, though just discarding these events into the dump file is also not a good option.
Various online tools for finding public data on ASes, found online via a quick search, give varying results.
â€
anda�
)‏
8207
��
I suppose there's no existing expectation of invalid UTF-8 sequences or special symbols like RTL marks in AS names, nor any "standard" way of handling them, and I feel iffy about passing arbitrary symbols like that on to other systems.
Are there any ideas for how to handle cases like this? The simplest option would be to simply pass the undecoded string on in case the decoding step fails.
The text was updated successfully, but these errors were encountered: