随笔分类 -  VC++ Unicode编码应用

摘要://宽字符转多字节 std::string W2A(const std::wstring& utf8) { int buffSize = WideCharToMultiByte(CP_ACP, NULL, utf8.c_str(), -1, NULL, NULL, NULL, FALSE); cha 阅读全文
posted @ 2019-04-11 21:17 findumars 阅读(425) 评论(0) 推荐(0) 编辑
摘要:转自:http://zyxhome.org/wp/cc-prog-lang/c-stdlib-setlocale-usage-note/ http://www.west263.com/info/html/caozuoxitong/FreeBSD/20090513/126191.html C 和 C+ 阅读全文
posted @ 2019-01-09 23:39 findumars 阅读(5123) 评论(0) 推荐(0) 编辑
摘要:ddd 阅读全文
posted @ 2019-01-09 23:35 findumars 阅读(634) 评论(0) 推荐(0) 编辑
摘要:悉Microsoft支持Unicode的方式。 它的主要目的是方便你查询相关的数据类型和函数,以及修正相应的拼写错误。 I18nGuy 主页 XenCraft (Unicode 咨询公司) English My thanks to Yaker Gong for the translation to 阅读全文
posted @ 2019-01-09 23:33 findumars 阅读(828) 评论(0) 推荐(0) 编辑
摘要:C/C++程序中,locale(即系统区域设置,即国家或地区设置)将决定程序所使用的当前语言编码、日期格式、数字格式及其它与区域有关的设置,locale设置的正确与否将影响到程序中字符串处理(wchar_t如何输出、strftime()的格式等)。因此,对于每一个程序,都应该慎重处理locale设置 阅读全文
posted @ 2019-01-09 23:26 findumars 阅读(3338) 评论(0) 推荐(0) 编辑
摘要:在C运行库提供的多字节字符-宽字符转换函数:mbstowcs()/wcstombs()中,需要用到全局变量locale( locale encoding ),以指定多字节字符的编码类型 1. 功能: 用来定义全局变量:locale(locale encoding) 头文件: setlocale <l 阅读全文
posted @ 2019-01-09 23:17 findumars 阅读(1482) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/cnyao/archive/2010/05/06/1729220.html setlocale()函数是用来配置地域信息的,原本以为这个也是windows函数,结果居然是C++的标准函数,其头文件为<clocale>,按照一般的原则,所有原本C的函数被移 阅读全文
posted @ 2019-01-09 23:15 findumars 阅读(350) 评论(0) 推荐(0) 编辑
摘要:setlocale 配置地域化信息。 语法: string setlocale(string category, string locale); 返回值: 字符串 函数种类: 操作系统与环境 本函数用来配置地域的信息。参数 category 有下列的选择: LC_ALL 包括下面的全项选项都要。 L 阅读全文
posted @ 2019-01-09 23:11 findumars 阅读(2297) 评论(0) 推荐(0) 编辑
摘要:序中,如果要将ASCII码字符串转换为宽字符(Unicode),可以利用标准C的mbstowcs函数。 微软在MSDN中有示例,如下: 然而,这段代码在处理含有汉字的字符串时就会出现问题。比如将: wchar_t *pwchello = L"Hi"; 替换为wchar_t *pwchello = L 阅读全文
posted @ 2019-01-09 23:06 findumars 阅读(1008) 评论(0) 推荐(0) 编辑
摘要:今天发现用securecrt登陆时,gcc编译出错时会出现乱码,但直接在主机的窗口界面下用Shell编译却没有乱码。查看了一下当时的错误描述,发现它的引号是中文引号,导致在SecureCRT中显示出错: before numeric constant 在网上查了一下,可以通过修改LC_CTYPE=z 阅读全文
posted @ 2019-01-09 23:01 findumars 阅读(1969) 评论(0) 推荐(0) 编辑
摘要:转自:http://zyxhome.org/wp/cc-prog-lang/c-stdlib-setlocale-usage-note/ [在此向原文作者说声谢谢!若有读者看到文章转载时请写该转载地址,不要写我的BLOG地址。尊重他人的劳动成果 ^_^ ] C 和 C++ 的标准库分别有自己的 lo 阅读全文
posted @ 2019-01-09 22:37 findumars 阅读(1102) 评论(0) 推荐(0) 编辑
摘要:I have been quite annoyed by a Windows bug that causes a huge number of open-source command-line tools to choke on multi-byte characters at the Window 阅读全文
posted @ 2019-01-09 22:29 findumars 阅读(441) 评论(0) 推荐(0) 编辑
摘要:C++中并不提倡继续使用C风格的字符串,而是为字符串定义了专门的类,名为string。 使用前的准备工作 在使用string类型时,需要包含string头文件,且string位于std命名空间内: #include <iostream> //... std::string str1 = "Hello 阅读全文
posted @ 2018-07-04 00:06 findumars 阅读(1287) 评论(0) 推荐(1) 编辑
摘要:1.strcpy字符串拷贝拷贝pStrSource到pStrDest,并返回pStrDest地址(源和目标位置重叠情况除外) 2.strcmp字符串比较 3.strstr字符串查找 4.strDelChar字符串删除字符 5.strrev字符串反序 6.memmove拷贝内存块 7.strlen字符 阅读全文
posted @ 2018-04-13 21:39 findumars 阅读(538) 评论(0) 推荐(0) 编辑
摘要:1、ANSI(即MBCS):为多字节字符集,它是不定长表示世界文字的编码方式。ANSI表示英文字母时就和ASCII一样,但表示其他文字时就需要用多字节。2、Unicode:用两个字节表示一个字符的编码方式。比如字符'A'在ASCII下面用一个字节表示,而在Unicode下面用两个字节表示,其中高字节 阅读全文
posted @ 2018-04-07 07:01 findumars 阅读(766) 评论(0) 推荐(0) 编辑
摘要:https://github.com/chigraph/chigraph/blob/master/third_party/boost/filesystem/windows_file_codecvt.cpp 阅读全文
posted @ 2017-12-05 20:45 findumars 阅读(982) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/ifpelset/articles/4523925.html 阅读全文
posted @ 2017-12-04 00:50 findumars 阅读(890) 评论(0) 推荐(0) 编辑
摘要:807down vote string? wstring? std::string is a basic_string templated on a char, and std::wstring on a wchar_t. char vs. wchar_t char is supposed to h 阅读全文
posted @ 2017-09-25 16:54 findumars 阅读(2020) 评论(1) 推荐(0) 编辑
摘要:1. size_type find_first_of( const basic_string &str, size_type index = 0 ); 查找在字符串中第一个与str中的某个字符匹配的字符,返回它的位置。搜索从index开始,如果没找到就返回string::npos 2. string 阅读全文
posted @ 2017-09-07 23:44 findumars 阅读(3984) 评论(0) 推荐(0) 编辑
摘要:码云项目推荐 1、项目名称: 中文转拼音库 pinyin4j 项目简介:Pinyin4j 是一个流行的 Java 库,支持中文字符和拼音之间的转换。拼音输出格式可以定制。 项目地址:https://gitee.com/cocho/pinyin4j 2、项目名称:汉字/拼音转换工具库 Pinyin4N 阅读全文
posted @ 2017-08-16 02:12 findumars 阅读(941) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示