Comments (7)
display-name
can be localized (e.g. non-ascii scripts). Its a newish feature (perhaps a year now) that allows non-western users to provide a native name.
Looking at the code, I don't know if I can fix this in 0.14.x
. There is a fatal flaw here:
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 &str/String
. But getting rid of this and just moving to a naive 'struct of indv. &str/String
would probably break the semver.
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 0.15.x
branch (#226). I can take this into consideration, but I'm still looking at providing one last 0.14.x
release. I'm going to think about a way of not breaking the semver when changing all of the internal memory representation of the types.
from twitchchat.
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 display-name
tag.
from twitchchat.
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 display-name
though.
Edit: Managed to get the user-id
from one of the crashing messages, here is a partial response from the /helix/users
endpoint with user in question:
{
"data": [
{
"id": "86293428",
"login": "yuebing233",
"display_name": "月饼",
...
}
]
}
from twitchchat.
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 Box<[(Cow<'a, str>, Cow<'a, str>)]>
internally and it wouldn't change the public API. This would ensure the tag and its index (now removed) are always using the same character (code point/scalar) boundaries.
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.
from twitchchat.
Looks great.
display-name
can be localized (e.g. non-ascii scripts). Its a newish feature (perhaps a year now) that allows non-western users to provide a native name.
Ah, neat.
from twitchchat.
I found a workaround, its not ideal but its transparent for the most part.
I've published 0.14.6
which fixes this problem.
from twitchchat.
Thank you!
from twitchchat.
Related Issues (20)
- The README is out of date. It mentions 0.13 and we're on 0.14
- TLS connectors can panic when DNS resolution fails
- Channel names should be lowercased, even if the user provided another casing. HOT 1
- Make a big note about the commands conversion
- Tracking issue for websockets HOT 1
- Upgrade to tokio 0.3 HOT 5
- Add support for tokio-openssl HOT 1
- Add support for async-net
- Look into caching for the CI
- Add CI steps for rustfmt, clippy, etc
- Crate panics when IRC tag "display-name" contains non valid ascii HOT 1
- Panic caused by an expect call HOT 9
- Privmsg::is_vip() incorrectly returns if the user is the broadcaster. HOT 1
- I'm looking for maintainers for this crate. HOT 4
- user_id type is different in Identity compared with user_id and room_id of messages HOT 1
- unexpected EOF in tokio_demo example HOT 4
- there is no reactor running, must be called from the context of a Tokio 0.2.x runtime HOT 2
- Chat commands are being deprecated
- Emote identifiers can be strings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitchchat.