Skip to content

Unicode 15 scripts and blocks are unrecognized #679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
benrimmington opened this issue Jun 29, 2023 · 3 comments
Open

Unicode 15 scripts and blocks are unrecognized #679

benrimmington opened this issue Jun 29, 2023 · 3 comments

Comments

@benrimmington
Copy link

The standard library was updated (by @Azoy) to use Unicode 15 data. Should the MissingUnicode.swift APIs also be updated?

/\p{Script=Arabic}/   // OK
/\p{Script=Kawi}/     // error: unrecognized script 'Kawi'
/\p{Block=Arabic}/    // error: Unicode block property is not currently supported
/\p{Block=Kawi}/      // error: unrecognized block 'Kawi'

(Old blocks are unsupported. New blocks are unrecognized.)

@benrimmington
Copy link
Author

Unrecognized names such as /\N{LOREM IPSUM}/ and /\p{Name=LOREM IPSUM}/ are allowed. However, unrecognized scripts and blocks are currently a compile-time and run-time error. This suggests that back-deployment of Regex literals might be a problem?

import Foundation

do {
  try Regex(#"\p{Script=Kawi}"#)
} catch {
  error.localizedDescription
}

The localized error description is unhelpful:

The operation couldn’t be completed. (_RegexParser.Source.LocatedError<_RegexParser.Diagnostics.(unknown context at $23808a414).(unknown context at $23808a41c).ErrorDiagnostic> error 1.)

@benrimmington
Copy link
Author

This issue was fixed in pull request #808. However, I'm still worried about back-deployment of Regex literals. Are there compile-time availability checks for the Unicode 15 and 16 scripts? Or will the Swift 5.7 runtime crash, due to an "unrecognized script" fatal error?

Cc: @Azoy @milseman @natecook1000 @stephentyrone

@benrimmington
Copy link
Author

The /\p{Script=Kawi}/ regex literal now compiles, but then crashes at runtime on the previous macOS version.

_StringProcessing/Core.swift:107: Fatal error: 'try!' expression unexpectedly raised an error: unrecognized script 'Kawi'

  • Xcode 16.3 (16E140)
  • macOS Sequoia 15.3.2 (24D81)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant