Files
player/Project/Src/MyApp/char_encode.h
2025-07-05 19:47:28 +08:00

71 lines
917 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CHAR_ENCODE_H__
#define CHAR_ENCODE_H__
#include "stm32f4xx.h"
#ifndef u8
# define u8 uint8_t
#endif
#ifndef u16
# define u16 uint16_t
#endif
#ifndef u32
# define u32 uint32_t
#endif
u8 *uni2utf8 (const u8 *uni_in,u8 **utf8_out);
u8 *utf82uni (const u8 *uft8_in,u8 **uni_out);
u8 *gbk2uni (u8 *gbk_in,u8 **uni_out);
//Unicode编码转GBK编码
//高字节在前
u8 *uni2gbk (u8 *uni_in,u8 **gbk_out);
//Unicode转utf-8
void uni2utf8_str (u8 *uni_in,u8 *utf8_out);
//UTF8转Unicode
void utf82uni_str (u8 *uft8_in,u8 *uni_out);
//GBK转Unicode
void gbk2uni_str (u8 *gbk_in,u8 *uni_out);
//Unicode编码转GBK编码
//高字节在前
void uni2gbk_str (u8 *uni_in,u8 *gbk_out);
//GBK转UTF8
void gbk2utf8_str (u8 *gbk_in,u8 *utf8_out);
//UTF8转GBK
void utf82gbk_str (u8 *utf8_in,u8 *gbk_out);
//汉字编码转化测试
//返回值
//0测试成功非0失败
int char_encode_test (char *str_input);
#endif