Uploaded image for project: 'Swift'
  1. Swift
  2. SR-6077

`Character` ends up accepting invalid emoji flag sequences.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Won't Do
    • Component/s: Standard Library
    • Labels:
      None
    • Environment:
      • Swift 4.0
      • OS: macOS, Ubuntu 16.04

      Description

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

      [code]

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              YOCKOW Knock YOCKOW
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: