71 lines
917 B
C
71 lines
917 B
C
#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
|
||
|