Skip to content

[SR-6077] Character ends up accepting invalid emoji flag sequences. #48632

Open
@YOCKOW

Description

@YOCKOW
Previous ID SR-6077
Radar None
Original Reporter @YOCKOW
Type Bug
Status Resolved
Resolution Won't Do
Environment
  • Swift 4.0

  • OS: macOS, Ubuntu 16.04

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: c82e0168fd3a0f487ee734ba7518dfc4

relates to:

  • SR-9206 Should literal Characters precondition on single-grapheme check?

Issue Description:

The Swift code below will be compiled without any errors, although it does not conform to Unicode segmentation algorithm.

let a: Character = "\u{1F1E6}" // REGIONAL INDICATOR SYMBOL LETTER A
let abc: Character = "\u{1F1E6}\u{1F1E7}\u{1F1E8}" //REGIONAL INDICATOR SYMBOL LETTER A-C

Expected Result
An error is raised such as error: cannot convert value of type 'String' to specified type 'Character'.

References

  • UAX #29
    > Do not break within emoji flag sequences. That is, do not break between regional indicator (RI) symbols if there is an odd number of RI characters before the break point.
    > GB12 sot (RI RI)* RI × RI
    > GB13 RI (RI RI)* RI × RI

  • UTS #51
    > emoji flag sequence — A sequence of two Regional Indicator characters, where the corresponding ASCII characters are valid region sequences
    > A singleton Regional Indicator character is called an ill-formed emoji flag sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CharacterArea → standard library: The `Character` typeStringArea → standard library: The `String` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.literalsFeature → expressions: Literals such as an integer or string literalstandard libraryArea: Standard library umbrellaunexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions