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 ...
随机推荐
- 浅谈求lca
lca即最近公共祖先,求最近公共祖先的方法大概有3种,其实是窝只听说过3种,这3种做法分别是倍增求lca,树剖求lca和tarjan求lca,但是窝只会前2种,所以这里只说前2种算法了. 首先是倍增求 ...
- AdminLTE的使用(转)
官方文档link1.AdminLTE的必要配置文件<!-- Tell the browser to be responsive to screen width --> <meta c ...
- js进阶 12-7 pageY和screenY以及clientY的区别是什么
js进阶 12-7 pageY和screenY以及clientY的区别是什么 一.总结 一句话总结:pageY是距文件,screenY是获取显示器屏幕位置的坐标,clientY是页面视口. 没有滚动条 ...
- 【rlz01】完全数
Time Limit: 3 second Memory Limit: 2 MB 问题描述 所谓完全数,就是这个数除了它本身的约数之和也等于这个数,比如说6的约数有1.2.3,而1+2+3=6,所以6是 ...
- 用Go写了一个相似Proxy的小程序,能够用来訪问goolge个人使用还是能够的.
package main import ( "fmt" "io" "net/http" ) func main() { http.Handl ...
- ModSecurity防御暴力破解
http://www.modsecurity.org/ ModSecurity防御暴力破解 在阅读本文前,先简单了解下什么是ModSecurity,ModSecurity是一个入侵探测与阻止的引擎.它 ...
- [转载]Ocelot简易教程(四)之请求聚合以及服务发现
上篇文章给大家讲解了Ocelot的一些特性并对路由进行了详细的介绍,今天呢就大家一起来学习下Ocelot的请求聚合以及服务发现功能.希望能对大家有所帮助. 作者:依乐祝 原文地址:https://ww ...
- 【53.90】【BZOJ 3875】 [Ahoi2014]骑士游戏
Time Limit: 30 Sec Memory Limit: 256 MB Submit: 564 Solved: 304 [Submit][Status][Discuss] Descriptio ...
- html5 video标签如何禁止视频下载
html5 video标签如何禁止视频下载 一.总结 一句话总结:bing方法给video对象绑定return false的匿名方法. 1.html5 video标签如何禁止视频下载? bing方法给 ...
- 【54.38%】【BZOJ 4300】绝世好题
Time Limit: 1 Sec Memory Limit: 128 MB Submit: 1120 Solved: 609 [Submit][Status][Discuss] Descript ...