GB2312 <-> UTF-8 转换
来源:互联网 发布:ppt软件免费吗 编辑:程序博客网 时间:2024/05/01 05:30
/* * 函数功能:UTF-8 到 GB2312 的转换 * 参数描述:[in ]utf8UTF-8 字符 * 返 回 值:GB2312 字符 */char* U2G(const char* utf8){int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);wchar_t* wstr = new wchar_t[len + 1];memset(wstr, 0, len + 1);MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wstr, len);len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);char* str = new char[len + 1];memset(str, 0, len + 1);WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);delete[] wstr;wstr = NULL;return str;}
/* * 函数功能:GB2312 到 UTF-8 的转换 * 参数描述:[in ]gb2312GB2312 字符 * 返 回 值:UTF-8 字符 */char* G2U(const char* gb2312){int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);wchar_t* wstr = new wchar_t[len+1];memset(wstr, 0, len+1);MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);char* str = new char[len+1];memset(str, 0, len+1);WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);delete[] wstr;wstr = NULL;return str;}
0 0
- UTF-8转换GB2312
- GB2312 <-> UTF-8 转换
- gb2312 utf-8 相互转换
- UTF-8转换GB2312函数
- java UTF-8转换GB2312
- UTF-8 转换成 GB2312
- UTF-8转换GB2312函数
- 编码转换utf-8/gb2312
- UTF-8和GB2312转换
- ASP汉字转换UTF-8以及UTF-8转换GB2312
- ASP汉字转换UTF-8及UTF-8转换GB2312
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 关于GB2312与UTF-8的转换
- gb2312 utf-8判断及转换
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 第 4 章 自定义登陆页面
- 基于模型的软件开发——互动出版网
- 【CSS学习】CSS Fonts(字体)
- LeetCode225——Implement Stack using Queues
- 目前宽带的接入方式有哪些
- GB2312 <-> UTF-8 转换
- Apache Camel分解(split)与聚合(aggregate)
- appcan localStorage 本地存储
- JS设置多选框处于选中状态
- CSU_1640_机智的刷题方式(完全背包)
- markDown语法
- dex文件结构分析-2
- HttpClient详解(一)—简介与请求
- java.面向对象