-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crate panics when IRC Tag contain non ascii characters #228
Comments
I see, was this from Twitch or were your parsing custom messages? I should look into issue templates, all I really need is the input data (or sample), the problem and the crate version. Its in the tags which I last added string escaping for. I'll see where its getting the indices wrong. I also assume it was the |
Yes, this was from Twitch. I don't really know how a non ascii character even gets into the display-name as it has to be the same as your username, just different capitalization. When titling the issue I assumed that all tags are parsed the same way, the issue is with Edit: Managed to get the {
"data": [
{
"id": "86293428",
"login": "yuebing233",
"display_name": "月饼",
...
}
]
} |
Looking at the code, I don't know if I can fix this in twitchchat/src/irc/tag_indices.rs Lines 39 to 40 in 1463334
I would need to calculate the byte offset of all further 'chars' which is something I don't really want to do. I kind of want to get rid of the the whole super-cheap indices approach. Currently, all of the messages, each, use a single allocation and then provide their 'sub-strings' as indices. These indices refer back to the single This'd allow me to use utf-8 aware splitting without having to really be considerate of boundaries -- let the std library provide that. I have quite a bit already pushed for the |
A bit more thinking, I can just change the tags representation -- it already has to allocate a boxed slice: twitchchat/src/irc/tag_indices.rs Lines 8 to 10 in 1463334
I can just make this a I would basically just remove the indices and make Lines 9 to 13 in 1463334
I don't think I expose most of this to the user so it shouldn't be breaking. |
Looks great.
Ah, neat. |
I found a workaround, its not ideal but its transparent for the most part. I've published |
Thank you! |
Here's the panic message:
Version:
0.14.5
cargo --version -v
:rustc --version -v
:Side note: Consider adding issue templates to make it easier to report bugs/make feature request 👍
The text was updated successfully, but these errors were encountered: