1 use core::char::REPLACEMENT_CHARACTER; 2 3 /// FAT文件系统保留开头的2个簇 4 pub const RESERVED_CLUSTERS: u32 = 2; 5 6 /// @brief 将u8转为ascii字符。 7 /// 当转码成功时,返回对应的ascii字符,否则返回Unicode占位符 8 pub fn decode_u8_ascii(value: u8) -> char { 9 if value <= 0x7f { 10 return value as char; 11 } else { 12 // 如果不是ascii字符,则返回Unicode占位符 U+FFFD 13 return REPLACEMENT_CHARACTER; 14 } 15 } 16