JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.4k stars 5.45k forks source link

Flags don't look right in the repl #46982

Open LilithHafner opened 1 year ago

LilithHafner commented 1 year ago

Expected:

julia> x = "🏳️‍⚧️"
"🏳️‍⚧️"

julia> print(x)
🏳️‍⚧️

Actual (characters):

julia> x = "🏳️‍⚧️"
"🏳️\u200d⚧️"

julia> print(x)
🏳️‍⚧️

Visual rendering on a Mac terminal:

Screen Shot 2022-09-30 at 7 12 32 AM

VSCode:

Screen Shot 2022-09-30 at 7 12 06 AM

Originally posted by @PallHaraldsson in https://github.com/JuliaLang/julia/issues/46104#issuecomment-1262910500

KristofferC commented 1 year ago

How does it look in your terminal outside of Julia?

giordano commented 1 year ago

Marginally related: #40071 (that's about the parser, but still related to emojis using ZWJ)

LilithHafner commented 1 year ago

How does it look in your terminal outside of Julia?

Screen Shot 2022-09-30 at 6 12 28 PM
KristofferC commented 1 year ago

VSCode: gnome-shell-screenshot-bxwszv

LilithHafner commented 1 year ago

Mac VSCode: Screen Shot 2022-09-30 at 6 52 33 PM

Keno commented 1 year ago

Yeah, it's related to #40071, in that we always escape ZWJ, but probably shouldn't if they're part of an emoji-ZWJ sequence, since they have single character presentation. It's a bit of a mess of an encoding, but I think just treating emoji-ZWJ sequences the same as regular emoji is probably the correct thing to do. The VSCode issue is unrelated and will need to be raised there.