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

Grapheme.split chops off the skull from the pirate flag #22

Open
ageron opened this issue Oct 10, 2024 · 0 comments
Open

Grapheme.split chops off the skull from the pirate flag #22

ageron opened this issue Oct 10, 2024 · 0 comments

Comments

@ageron
Copy link
Contributor

ageron commented Oct 10, 2024

This must be the weirdest issue name I've ever submitted! 😂

Here's a little program to reproduce the issue:

app [main] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
    unicode: "https://github.com/roc-lang/unicode/releases/download/0.1.2/vH5iqn04ShmqP-pNemgF773f86COePSqMWHzVGrAKNo.tar.br",
}

import unicode.Grapheme
import pf.StdOut

main =
    result = Grapheme.split "🏴‍☠️🏁🎌🚩🏳️‍🌈"
    StdOut.line! (result |> Inspect.toStr)

The output is:

(Ok ["🏴‍️", "🏁", "🎌", "🚩", "🏳️‍🌈"])

But it should be:

(Ok ["🏴‍☠️", "🏁", "🎌", "🚩", "🏳️‍🌈"])

The pirate flag is composed of three code-points: 🏴 (black flag), \u200d (zero width joiner), and ☠️ (skull), but Grapheme.split drops the ☠️ codepoint, preserving only the first two (the second is invisible, but it's there, I checked).

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

1 participant