Skip to content
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

Struggles to truncate UTF-8 #11

Open
soundasleep opened this issue Jun 26, 2018 · 2 comments
Open

Struggles to truncate UTF-8 #11

soundasleep opened this issue Jun 26, 2018 · 2 comments

Comments

@soundasleep
Copy link

Not sure how you could resolve this, but it looks like smart-truncate does not play nicely with UTF-8...

smart truncate

It might be helpful to add a note in the README that it doesn't play nicely with UTF-8.

@millerized
Copy link
Owner

@soundasleep – Thanks a bunch for reporting this! I apologize for the delayed response!I will try to fix this asap. If you have any ideas on a good approach for handling this, I would love to hear 🍻

@millerized millerized added this to TODO in Core Roadmap Jul 9, 2018
@soundasleep
Copy link
Author

I'm not an expert on Javascript strings, but it might depend on what the native format for Javascript strings are (apparently UTF-16-ish?), if there are any libraries to deal with UTF-8 substring (unicode-substring?), and how much performance drop your users are OK with... maybe create a separate smart-truncate-utf8 project, or a separate require(), or just add a note to the README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants