Skip to content

Chinese, Japanese, emoji, full-width symbol characters miscounting #2

@rikkihamano

Description

@rikkihamano

image

image

image

image

image

So for Chinese, Japanese, emoji, full-width symbol characters, each of them takes up spaces twice than English letters.
However, with egg-mode-text 1.15.0 and the test code as below:

fn main() {
    println!("{}", egg_mode_text::character_count("hello", 23, 23));
    println!("{}", egg_mode_text::character_count("你好!", 23, 23));
    println!("{}", egg_mode_text::character_count("おはよう", 23, 23));
    println!("{}", egg_mode_text::character_count("🌞", 23, 23));
}

It prints out

5
3
4
1

, which should be 5, 6, 8, 2 instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions