简体   繁体   English

如何将unicode转换为符号C

[英]How to convert unicode to symbol C

How to convert Unicode Hexadecimal for print/write? 如何转换Unicode十六进制以进行打印/写入?

Input: 输入:

0x00DF

Desired Output: 所需输出:

ß

Symbol: 符号:

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

If your C implementation and your terminal support unicode, then 如果您的C实现和终端支持unicode,则

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

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

This is on FreeBSD with clang and xterm and LC_CTYPE=de_DE.UTF-8 (but any *.UTF-8 will do). 这是在带有clang和xterm以及LC_CTYPE=de_DE.UTF-8 FreeBSD上的(但是任何* .UTF-8都可以)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM