CP_ACP : CP_OEMCP
// filesystem windows_file_codecvt.cpp -----------------------------------------// // Copyright Beman Dawes 2009 // Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem //--------------------------------------------------------------------------------------// // define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE #ifndef BOOST_SYSTEM_NO_DEPRECATED
# define BOOST_SYSTEM_NO_DEPRECATED
#endif #include <boost/filesystem/config.hpp>
#include <cwchar> // for mbstate_t #ifdef BOOST_WINDOWS_API #include "windows_file_codecvt.hpp" // Versions of MinGW prior to GCC 4.6 requires this
#ifndef WINVER
# define WINVER 0x0500
#endif #include <windows.h> std::codecvt_base::result windows_file_codecvt::do_in(
std::mbstate_t &,
const char* from, const char* from_end, const char*& from_next,
wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const
{
UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; int count;
if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from,
from_end - from, to, to_end - to)) == )
{
return error; // conversion failed
} from_next = from_end;
to_next = to + count;
*to_next = L'\0';
return ok;
} std::codecvt_base::result windows_file_codecvt::do_out(
std::mbstate_t &,
const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next,
char* to, char* to_end, char* & to_next) const
{
UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; int count;
if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from,
from_end - from, to, to_end - to, , )) == )
{
return error; // conversion failed
} from_next = from_end;
to_next = to + count;
*to_next = '\0';
return ok;
} # endif // BOOST_WINDOWS_API
https://github.com/chigraph/chigraph/blob/master/third_party/boost/filesystem/windows_file_codecvt.cpp
CP_ACP : CP_OEMCP的更多相关文章
- VC中支持中文的字符串比较函数
VS2008开发环境,多字符集和UNICODE字符集都可用. WCHAR * mbcsToUnicode(const char *zStr) { int nByte; WCHAR *zMbcsStr; ...
- unicode字符和多字节字符的相互转换接口
作者:朱金灿 来源:http://blog.csdn.net/clever101 发现开源代码的可利用资源真多,从sqlite3的源码中抠出了几个字符转换接口,稍微改造下了发现还挺好用的.下面是实现代 ...
- sqlite学习笔记之sqlite3_open函数的使用
作者:朱金灿 来源:http://blog.csdn.net/clever101 打开sqlite数据库需要用到sqlite3_open函数,但是sqlite3_open函数的第一个参数是数据库文件的 ...
- Windows上的字符转换之CP_ACP和CP_OEMCP
原文地址:http://blog.sina.com.cn/s/blog_53c1950a010158mw.html Windows API函数MultiByteToWideChar用于多字节编码字符串 ...
- CP_THREAD_ACP与CP_ACP
在使用MultiByteToWideChar的时候,大部分都知道上述两个参数,MSDN上的解释也是简单到极致.通常我们会选择使用CP_ACP,但是总有人会在没有真正明白它们之间的区别前使用CP_THR ...
- 关于多字节、宽字节、WideCharToMultiByte和MultiByteToWideChar函数的详解
所谓的短字符,就是用8bit来表示的字符,典型的应用是ASCII码. 而宽字符,顾名思义,就是用16bit表示的字符,典型的有UNICODE. **************************** ...
- C#封装好的Win32API
Kernel.cs using System; using System.Runtime.InteropServices; using System.Text; using HANDLE = Syst ...
- C#和VC++字符集和编码
C# char 关键字用于声明 .NET framework 使用 Unicode 字符表示 System.Char 结构的实例. Char 对象的值是 16 位数字 (序号值.)将字符表示为 UTF ...
- VC++编程中常用的字符串转换函数
VC++编程中经常遇到不同编码编码的字符串之间需要转换的情况,以下简单提供几个不同编码字符串之间的转换函数: ANSI 字符串和Unicode字符串之间的转换 //Convert wide char ...
随机推荐
- 【习题 5-2 UVA-1594】Ducci Sequence
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] map加vector轻松搞定. [代码] #include <bits/stdc++.h> using namespac ...
- BI并不是万能,中层业务管理报表要另辟蹊径
BI是商业智能的缩写,是能够帮助企业做出明智的业务经营决策的工具.其数据来源于各个业务系统.如ERP.CRM.SCM.进销存.HER.OA等. BI系统不同于传统的管理信息 ...
- AndroidAnnotations使用说明书—AndroidAnnotations是怎样工作的?
AndroidAnnotations的工作方式非常easy.它使用标准的java注入处理工具,自己主动加入了一个额外的编译步骤来生成源码. 源代码是什么?每个增强的类,比方每个用@EActivity注 ...
- MyBatis Generator插件之SerializablePlugin
org.mybatis.generator.plugins.SerializablePlugin 在generatorConfig.xml中加上配置: <plugin type="or ...
- Bash玩转脚本1之自己的脚本安装程序
Bash之打造自己的脚本安装器 前言 还是理所当然的前言,我一直想找一套管理脚本的"框架",能让自己杂乱的脚本有点规整.无奈眼界尚浅,未能找到. 因此萌生自己写一点优化脚本的工具来 ...
- [Angular] Ngrx/effects, Action trigger another action
@Injectable() export class LoadUserThreadsEffectService { constructor(private action$: Actions, priv ...
- 剔除list中相同的结构体数据
剔除list中相同的结构体数据,有三个思路:1.两层循环,逐个比较 2.使用set容器来剔除 3.使用unique方法去重 // deduplication.cpp : 定义控制台应用程序的入口点. ...
- Android中密码输入内容可见性切换
今天在做项目的时候遇到了一个关于密码输入框可见性切换问题,上网搜了搜,这里面门道还不小,做一个记录吧,下次遇到就好解决了. 首先写了一个简单的测试工程: <LinearLayout xmlns: ...
- EM12C 安装及卸载 注意点整理
版本号: em12c 12.1.0.4 OS : redhat 5.7 x86_64bit (CentOS6.2,測试过,当时因glibc*.i686包安装一直报错.所以放弃了) ...
- [Postgres] Update and Delete records in Postgres
Delete example: DELETE FROM movies ; Update example: UPDATE movies ;