gpt4 book ai didi

c - 如何将unicode转换为符号C

转载 作者:太空宇宙 更新时间:2023-11-04 08:39:15 26 4
gpt4 key购买 nike

如何将 Unicode 十六进制转换为打印/写入?

输入:

0x00DF

期望的输出:

ß

符号:

http://www.unicodemap.org/details/0x00DF/index.html

最佳答案

如果你的 C 实现和你的终端支持 unicode,那么

$ cat tst.c
#include <stdio.h>

int main (void)
{
printf ("\u00DF\n");
return 0;
}
$ cc tst.c
$ ./a.out
ß
$

这是在 FreeBSD 上使用 clang 和 xterm 以及 LC_CTYPE=de_DE.UTF-8(但任何 *.UTF-8 都可以)。

关于c - 如何将unicode转换为符号C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24536028/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com