Skip to content

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

@ageron

Description

@ageron

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions