mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 03:42:47 +08:00
для update c brunch/Docx2DoctConverter
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61913 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
b94effbd4f
commit
90cf06377c
@ -1,73 +0,0 @@
|
||||
#include "Encoding.h"
|
||||
#include "Utility.h"
|
||||
#include "../Common/SimpleTypes_Word.h"
|
||||
|
||||
|
||||
AVSINLINE const CStringA Encoding::ansi2utf8 (const CStringA &sLine)
|
||||
{
|
||||
return wstring2string( string2wstring( sLine, CP_ACP ), CP_UTF8 );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringW Encoding::ansi2unicode (const CStringA &sLine)
|
||||
{
|
||||
return string2wstring( sLine, CP_ACP );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringA Encoding::utf82ansi (const CStringA &sLine)
|
||||
{
|
||||
return wstring2string( string2wstring( sLine, CP_UTF8 ), CP_ACP );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringW Encoding::utf82unicode (const CStringA &sLine)
|
||||
{
|
||||
return string2wstring( sLine, CP_UTF8 );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringA Encoding::unicode2ansi (const CStringW &sLine)
|
||||
{
|
||||
return wstring2string( sLine, CP_ACP );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringA Encoding::unicode2utf8 (const CStringW &sLine)
|
||||
{
|
||||
return wstring2string( sLine, CP_UTF8 );
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringA Encoding::wstring2string(const CStringW &sLine, const unsigned int unCodePage)
|
||||
{
|
||||
const int nSize = WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0, NULL, NULL );
|
||||
char *sTemp = new char[nSize];
|
||||
if ( !sTemp )
|
||||
return "";
|
||||
|
||||
WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), sTemp, nSize, NULL, NULL );
|
||||
|
||||
CStringA sResult( sTemp );
|
||||
delete []sTemp;
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
|
||||
AVSINLINE const CStringW Encoding::string2wstring(const CStringA &sLine, const unsigned int unCodePage)
|
||||
{
|
||||
const int nSize = MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0 );
|
||||
|
||||
wchar_t *sTemp = new wchar_t[nSize];
|
||||
if ( !sTemp )
|
||||
return _T("");
|
||||
|
||||
MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), sTemp, nSize );
|
||||
|
||||
CStringW sResult( sTemp );
|
||||
delete []sTemp;
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user