Skip to content

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

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

Closed
SimonSapin opened this issue Feb 16, 2014 · 0 comments
Closed

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

SimonSapin opened this issue Feb 16, 2014 · 0 comments

Comments

@SimonSapin
Copy link
Contributor

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"
@huonw huonw closed this as completed in 35b1b62 Feb 19, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue May 2, 2024
flip1995 pushed a commit to flip1995/rust that referenced this issue May 2, 2024
[arithmetic_side_effects] Fix rust-lang#12318

Fix rust-lang#12318

changelog: [arithmetic_side_effects]: Consider method calls that correspond to arithmetic symbols
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