Skip to content

utf16_chars incorrect for even-numbered non-BMP planes #12318

Closed
@SimonSapin

Description

@SimonSapin

The code uses c |= 0x1_0000_u32 where it should use c += 0x1_0000_u32.

Test case:

use std::str;

fn main() {
    let a = "\U00020000";
    let b = a.to_utf16();
    let c = str::from_utf16(b);
    println!("{:?}", a);
    println!("{:?}", b);
    println!("{:?}", c)
}

Output:

"\U00020000"
~[55360u16, 56320u16]
~"\U00010000"

Expected output:

"\U00020000"
~[55360u16, 56320u16]
~"\U00020000"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions