decodecharset.cpp

来自「hl2 source code. Do not use it illegal.」· C++ 代码 · 共 51 行

CPP
51
字号
/*----------------------------------------------------------------------
Copyright (c) 1998,1999 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File:	DecodeCharset.cpp
Owner:	russf@gipsysoft.com
Purpose:	<Description of module>.
----------------------------------------------------------------------*/
#include "stdafx.h"
#include <DebugHlp.h>
#include <Winhelper.h>
#include "QHTM_Types.h"
#include "smallstringhash.h"
#include "StaticString.h"

extern BYTE DecodeCharset( const CStaticString &strCharSet );

struct StructCharSet
{
	LPCTSTR m_pcszName;
	BYTE m_cCharSet;
};

static const StructCharSet g_arrCharSet[] =
{
	{ _T("windows-1250"), EASTEUROPE_CHARSET },
	{ _T("windows-1251"), RUSSIAN_CHARSET },
	{ _T("windows-1252"), ANSI_CHARSET },
	{ _T("windows-1253"), GREEK_CHARSET },
	{ _T("windows-1254"), TURKISH_CHARSET },
	{ _T("windows-1255"), HEBREW_CHARSET },
	{ _T("windows-1256"), ARABIC_CHARSET },
	{ _T("windows-1257"), BALTIC_CHARSET },
	{ _T("gb2312"), GB2312_CHARSET },
	{ _T("windows-OEM"),	OEM_CHARSET }
	
};


BYTE DecodeCharset( const CStaticString &strCharSet )
{
	for( UINT u = 0; u < countof( g_arrCharSet ); u++ )
	{
		if( !_tcsnicmp( g_arrCharSet[ u ].m_pcszName, strCharSet.GetData(), strCharSet.GetLength() ) )
		{
			return g_arrCharSet[ u ].m_cCharSet;
		}
	}

	TRACE( _T("Unknown characters set\n") );
	return DEFAULT_CHARSET;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?