[SR-6077] Character
ends up accepting invalid emoji flag sequences.
#48632
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Character
Area → standard library: The `Character` type
literals
Feature → expressions: Literals such as an integer or string literal
standard library
Area: Standard library umbrella
String
Area → standard library: The `String` type
unexpected behavior
Bug: Unexpected behavior or incorrect output
Environment
Swift 4.0
OS: macOS, Ubuntu 16.04
Additional Detail from JIRA
md5: c82e0168fd3a0f487ee734ba7518dfc4
relates to:
Issue Description:
The Swift code below will be compiled without any errors, although it does not conform to Unicode segmentation algorithm.
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.
The text was updated successfully, but these errors were encountered: