Files
player/Project/Src/MyApp/char_encode.h

71 lines
963 B
C
Raw Normal View History

2025-06-27 00:32:57 +08:00
#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