Skip to content

Unicode 17? #1387

Closed
Closed

Description

@ajvondrak

Unicode 17.0.0 has been out since 2025 September 9: https://www.unicode.org/versions/Unicode17.0.0/

Rust updated shortly thereafter: rust-lang/rust#146330

But the latest update for regex-syntax seems to be from Unicode 16: 9239e7e

The disagreement causes divergent behavior, for example between char methods and regex character classes: EDIT: bad example, see #1387 (comment) instead.

Bad Example
[package]
name = "repro"
version = "0.1.0"
edition = "2024"

[dependencies]
regex = "1.13.1"
use regex::Regex;

fn main() {
    dbg!(char::UNICODE_VERSION);
    let c = '\u{323B0}';
    dbg!(c.is_alphabetic());
    dbg!(Regex::new(r"[[:alpha:]]").unwrap().is_match(&c.to_string()));
}
$ cargo run
   Compiling repro v0.1.0 (/private/tmp/repro)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.69s
     Running `target/debug/repro`
[src/main.rs:4:5] char::UNICODE_VERSION = (
    17,
    0,
    0,
)
[src/main.rs:6:5] c.is_alphabetic() = true
[src/main.rs:7:5] Regex::new(r"[[:alpha:]]").unwrap().is_match(&c.to_string()) = false

Two separate thoughts:

  1. Can we bump to Unicode 17?
  2. Could we expose a UNICODE_VERSION constant a la char::UNICODE_VERSION (or as in other crates, like unicode_ident::UNICODE_VERSION, unicode_normalization::UNICODE_VERSION, etc)? This could make it easier for some users to catch such version drift in the future, similar to this code: https://github.com/rust-lang/rust/blob/a04c7a037d59b6dedc9f921e84e391f13a257aa4/compiler/rustc_parse/src/lib.rs#L39-L75

Thanks!

Activity

  1. ajvondrak commented on Aug 11, 2026

    @ajvondrak
    Author

    Woops, just realized my example uses [[:alpha:]], which is specifically the ASCII alphabetic range. That was just my attempt to simplify the repro from the actual issue I encountered, where \p{XID_Start} wasn't aligning with unicode_ident::is_xid_start (which uses Unicode 17). Same basic idea though:

    [package]
    name = "repro"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    regex = "1.13.1"
    unicode-ident = "1.0.24"
    use unicode_ident::is_xid_start;
    use regex::Regex;
    
    fn main() {
        dbg!(unicode_ident::UNICODE_VERSION);
        let c = '\u{323B0}';
        dbg!(is_xid_start(c));
        dbg!(Regex::new(r"\p{XID_Start}").unwrap().is_match(&c.to_string()));
    }
    $ cargo run
       Compiling repro v0.1.0 (/private/tmp/repro)
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.41s
         Running `target/debug/repro`
    [src/main.rs:5:5] unicode_ident::UNICODE_VERSION = (
        17,
        0,
        0,
    )
    [src/main.rs:7:5] is_xid_start(c) = true
    [src/main.rs:8:5] Regex::new(r"\p{XID_Start}").unwrap().is_match(&c.to_string()) = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions