We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rust version: rustc 1.80.0-nightly encoding_rs version: 0.8.34
#[test] fn test_utf16(){ // UTF-8 字符串 let utf8_string = "示例文本"; // 将 UTF-8 字符串转换为 UTF-16BE 编码的字节向量 let (utf16be_bytes, _, had_errors) = UTF_16BE.encode(utf8_string); println!("原始 UTF-8 字符串: {}", utf8_string); println!("UTF-16BE 编码的字节: {:?}", utf16be_bytes); // 将 UTF-16BE 编码的字节向量转换回 UTF-8 字符串 let (decoded_utf8, _,_) = UTF_16BE.decode(&utf16be_bytes); println!("解码后的 UTF-8 字符串: {}", decoded_utf8); }
result: 原始 UTF-8 字符串: 示例文本 UTF-16BE 编码的字节: [231, 164, 186, 228, 190, 139, 230, 150, 135, 230, 156, 172] 解码后的 UTF-8 字符串: 뫤뺋蟦鲬
The text was updated successfully, but these errors were encountered:
No branches or pull requests
rust version: rustc 1.80.0-nightly
encoding_rs version: 0.8.34
result:
原始 UTF-8 字符串: 示例文本
UTF-16BE 编码的字节: [231, 164, 186, 228, 190, 139, 230, 150, 135, 230, 156, 172]
解码后的 UTF-8 字符串: 뫤뺋蟦鲬
The text was updated successfully, but these errors were encountered: