-
Notifications
You must be signed in to change notification settings - Fork 236
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
c2rust translate unicode to utf8 but Rust doesn't support #762
Comments
@wain303009, I'm unsure what the error is here. #include <stdio.h>
int main() {
printf("\n \e[32m\u2713 \e[90mok\e[0m\n\n");
} turns into (playground) #![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)]
extern "C" {
fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
}
unsafe fn main_0() -> libc::c_int {
printf(
b"\n \x1B[32m\xE2\x9C\x93 \x1B[90mok\x1B[0m\n\n\0" as *const u8
as *const libc::c_char,
);
return 0;
}
pub fn main() {
unsafe { ::std::process::exit(main_0() as i32) }
} which compiles and runs fine. Perhaps you meant that print!("\n \x1B[32m\xE2\x9C\x93 \x1B[90mok\x1B[0m\n\n\0"); doesn't compile, but that's because that's a
|
after translation of c2rust:
Though both kind of string are supported by C, Rust only support the first unicode other than the second utf8, and compiler will report error as following:
print! ("\n \x1B[32m\xE2\x9C\x93 \x1B[90mok\x1B[0m\n\n\0"); ^^^^ must be a character in the range [\x00-\x7f]
The text was updated successfully, but these errors were encountered: