Skip to content

Wrong graphemes length of 🤦🏼‍♂️ emoji #62

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

Closed
weihanglo opened this issue Sep 10, 2019 · 1 comment
Closed

Wrong graphemes length of 🤦🏼‍♂️ emoji #62

weihanglo opened this issue Sep 10, 2019 · 1 comment

Comments

@weihanglo
Copy link

I read this post and found that segmentation over this emoji is wrong due to new rule of ZERO WIDTH JOINER. Concerning I have only little knowledge about Unicode, is there anything I can help?

Reproducible Demo

Playground Link

use unicode_segmentation::UnicodeSegmentation;

fn main() {
	let s = "🤦🏼‍♂️";
	println!("{}", s.graphemes(true).count());
	println!("{}", s.chars().count());
	println!("{}", s.encode_utf16().count());
	println!("{}", s.len());
}

// 2 <---- should be 1
// 5
// 7
// 17
@Manishearth
Copy link
Member

This crate needs an update. #43

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

No branches or pull requests

2 participants