Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何制作从 UTF8 Cyrillic 转换为 UTF8 Latin 字符的函数?我知道我应该制作字符表,但我的主要问题是如何表示字符串(在 C ,Linux OS 中)?作为 char* 或 int* (由于 UTF8 的大小)?
void convert(unsigned char* str) { if(str[0] == 'A' ) str[0] = 0xd090; // Cyrillic A ... }
您不能将 a 替换char为int(or short),因为它不适合 a char。要么将拉丁字符读入wchar_t数组,要么为西里尔字符使用单独的输出数组。
char
int
short
wchar_t