📄 unicode.h
字号:
#ifndef UNICODE_H#define UNICODE_H/*// The documentation below comes from the fd32 project.// The implementation is separate though.A UTF-8 character is converted to a wide character (UTF-32 or UCS-4)using the following rules (binary numbers):\codeUTF-32 - UTF-800000000 00000000 0aaaaaaa - 0aaaaaaa00000000 00000bbb bbaaaaaa - 110bbbbb 10aaaaaa00000000 ccccbbbb bbaaaaaa - 1110cccc 10bbbbbb 10aaaaaa000dddcc ccccbbbb bbaaaaaa - 11110ddd 10cccccc 10bbbbbb 10aaaaaa\endcodeA UTF-16 character is converted to a wide character (UTF-32 or UCS-4)using the following rules (binary numbers):\codeUTF-32 - UTF-1600000000 aaaaaaaa aaaaaaaa <-> aaaaaaaa aaaaaaaa000bbbbb aaaaaaaa aaaaaaaa <-> 110110cc ccaaaaaa 110111aa aaaaaaaa\endcodewhere \c cccc = \c bbbbb - 1.*/// \brief Returns the length in bytes of a UTF8 encoded character// \param lead_byte The first byte in the UTF8 encoded Unicode character// \return Length int unicode_utf8_len_(char lead_byte);// \brief One UTF8 encoded character is read and converted to an int// \param s The source buffer// \param result Pointer to where to put result// \return The number of bytes used to decode one Unicode characterint unicode_utf8_to_wchar_(int *result, const char *s);// \brief One unicode character is converted to UTF8. // \param s The destination buffer// \param wc Unicode character to be converted// \param wsize Size of output buffer// \return The length (in char) of the UTF8 encoded characterint unicode_wchar_to_utf8_(char *s, int wc, int size);// \brief Convert to common case for string comparison// \param wc Unicode character to be convertedint unicode_simple_fold_( int wc );#endif // UNICODE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -