`

work_unicode

 
阅读更多
BOOL EncodingHandler::MByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, int dwMultiSize)
{
	// Convert headers from ASCII to Unicode.
	//chenjian_unicode 后需要改添加if的条件
	UINT acp = GetACP();
	memset(lpwszStr, 0, dwMultiSize * 2);
	if(UINT(936) == acp)
	{		
		MultiByteToWideChar (CP_ACP, NULL, lpcszStr, -1, lpwszStr, dwMultiSize);  
	}
	else
	{
		MultiByteToWideChar(936, NULL, lpcszStr, -1, lpwszStr, dwMultiSize); //936
	}
	return TRUE;
}

BOOL EncodingHandler::WCharToMByte(LPCWSTR lpcwszStr, LPSTR lpszStr, int dwMultiSize)
{
	// Convert headers from Unicode to ASCII.
	memset(lpszStr, 0, dwMultiSize);
	WideCharToMultiByte (CP_OEMCP, NULL, lpcwszStr, -1, lpszStr, dwMultiSize,NULL,FALSE);  
	return TRUE;
}

BOOL EncodingHandler::UTF8ByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, int dwMultiSize)
{
	// Get the required size of the buffer that receives the Unicode 
	// string. 
	DWORD dwMinSize;
	memset(lpwszStr, 0, dwMultiSize * 2);
	dwMinSize = MultiByteToWideChar (CP_UTF8, 0, lpcszStr, -1, NULL, 0);

	if(dwMultiSize < dwMinSize)
	{
		return FALSE;
	}


	// Convert headers from UTF8 to Unicode.
	MultiByteToWideChar (CP_UTF8, 0, lpcszStr, dwMultiSize, lpwszStr, dwMinSize);  
	return TRUE;
}

BOOL EncodingHandler::WCharToUTF8Byte(LPCWSTR lpcwszStr, LPSTR lpszStr, int dwMultiSize)
{
	// Convert headers from Unicode to UTF8.
	memset(lpszStr, 0, dwMultiSize);
	WideCharToMultiByte (CP_UTF8, NULL, lpcwszStr, -1, lpszStr, dwMultiSize,NULL,FALSE);  
	return TRUE;
}

 

const BOOL ListView::C2TC(const char * c, PTCHAR tc,DWORD dwSize)
{ 
#if defined(UNICODE)
	UINT acp = GetACP();
	if(UINT(936) == acp)//后续要改,添加if条件
	{
		MultiByteToWideChar(CP_ACP, 0, c, -1, tc, strlen(c));
		tc[strlen(c)] = 0;
	}
	else{
		C2TC_AnsiUTF8Document(c, tc, dwSize);
	}

#else
	lstrcpy((PTSTR)tc, (PTSTR)c);
#endif

	return TRUE;
}

const BOOL ListView::TC2C(const PTCHAR tc, char * c,DWORD dwSize)
{
	DWORD dwMinSize;
	dwMinSize = WideCharToMultiByte(GetACP(),NULL,tc,-1,NULL,0,NULL,FALSE);
	if(dwSize < dwMinSize)
	{
		return FALSE;
	}
	WideCharToMultiByte(GetACP(),NULL,tc,-1,c,dwSize,NULL,FALSE);
	return TRUE;
}
const BOOL  ListView::C2TC_AnsiUTF8Document(const char * c, PTCHAR tc,DWORD dwSize)
{
	int wcsLen = MultiByteToWideChar(936, NULL, c, strlen(c), NULL, 0); //936		
	MultiByteToWideChar(936, NULL, c, strlen(c), tc, wcsLen); //936
	tc[wcsLen] = 0; 
	return TRUE;
}
//const BOOL  ListView::TC2C_AnsiDocument(const PTCHAR tc, char * c,DWORD dwSize)
//{
//	int ansiLen = WideCharToMultiByte(GetACP(), NULL, tc, wcslen(tc), NULL, 0, NULL, NULL); 
//	WideCharToMultiByte(GetACP(), NULL, tc, wcslen(tc), c, ansiLen, NULL, NULL);
//	return TRUE;
//}

const BOOL  ListView::TC2C_UTF8Document(const PTCHAR tc, char * c,DWORD dwSize)
{
	//int ansiLen = WideCharToMultiByte(936, NULL, wszStringSource, wcslen(wszStringSource), NULL, 0, NULL, NULL); 
	//char* szAnsi = new char[ansiLen + 1]; 
	//WideCharToMultiByte(936, NULL, wszStringSource, wcslen(wszStringSource), szAnsi, ansiLen, NULL, NULL); 
	//szAnsi[ansiLen] = '\0'; //szAnsi = 0x00547bf8 "Äã"

	char* old_locale = _strdup( setlocale(LC_CTYPE,NULL) ); 
	setlocale( LC_CTYPE, "chs" );
	sprintf(c,"%S",tc);
	setlocale( LC_CTYPE, old_locale ); 
	delete old_locale;//还原区域设定
	return TRUE;
}

//
//const BOOL  ListView::UTF82TC_UTF8Document(const char * c, PTCHAR tc,DWORD dwSize)
//{
//	EncodingHandler::UTF8ByteToWChar( c, tc, dwSize);
//	return TRUE;
//}
//const BOOL  ListView::TC2UTF8_UTF8Document(const PTCHAR tc, char * c,DWORD dwSize)
//{
//	int u8Len = WideCharToMultiByte(CP_UTF8, NULL, tc, wcslen(tc), NULL, 0, NULL, NULL); 
//	// unicode to UTF8 
//	EncodingHandler::WCharToUTF8Byte(tc, c, u8Len);
//	return TRUE;
//}
//chenjian_unicode add end

 

1)      BlockManager.cpp 含有中文字符  自选股

TradeObject.cpp中含有中文字符  万亿

在英文系统下将乱码修改

 

2)修改代码

BlockManager.cpp

ListView.cpp

QuotesListView.cpp

EncodingHandler.cpp

ListView.h

 

分享到:
评论

相关推荐

    NSIS_2.46_Unicode版本

    这个"NSIS_2.46_Unicode版本"是NSIS的一个特定构建,特别针对非中文环境下的安装问题进行了优化,确保在系统语言为非中文时也能顺利进行安装操作。 NSIS的核心特性包括: 1. **脚本驱动**:NSIS安装程序的逻辑是...

    replace-unicode-string.rar_ Unicode Reader _Work It

    replace-unicode-string: a small tool used to replace unicodes strings in unicode file ( when we use sed -i on windows, it would not work for string replacement on unicode file, so I wrote these tool)....

    DirectoryString.rar_The Work

    在描述的"DirectoryString.rar_The Work"中,我们关注的是ASN.1中的DirectoryString结构及其在Java环境下的编码和解码工作。 DirectoryString是X.509证书中常用的组件,通常用于存储用户或实体的名字。它允许各种...

    unrxlib_275_u_1_0_13

    14/ some functions added into module RxVerInf for better work with versions. Note for users Delphi 5/6/7: ---------------------------- RxLibrary is not directly designed for this Delphi versions. ...

    DCPcrypt(v3b3 UNICODE修正)+2个Demo

    Update for Delphi 2009/2010: thanks to Lorenzo Monti for providing updated string encryption routines to work with unicode strings. Update for Delphi 2009: thanks to Henri Gourvest for providing an ...

    C practice work.zip_c;编程

    在给定的“C practice work.zip”压缩包中,我们可以看到两个关键文件:“show character.c”和“show character.exe”,它们与在控制台显示汉字的技术紧密相关。 首先,"show character.c" 是一个C源代码文件,它...

    delphixe10 RxLib_For_RX10插件

    14/ some functions added into module RxVerInf for better work with versions. Note for users Delphi 5/6/7: ---------------------------- RxLibrary is not directly designed for this Delphi versions. ...

    RX Lib_For D5~XE2 XE3

    14/ some functions added into module RxVerInf for better work with versions. Note for users Delphi 5/6/7: ---------------------------- RxLibrary is not directly designed for this Delphi versions. ...

    Python-使用pythonscrapy抓取拉钩java招聘信息并制作成词云

    使用`json.loads(response.body_as_unicode())`将响应体转换为Python字典,然后遍历数据,提取职位名称、公司名称、工作地点等关键信息。 ```python def parse(self, response): data = json.loads(response.body_...

    FatFs移植.docx

    如果希望FatFs API支持Unicode编码,可以将`_LFN_UNICODE`设为1。 在系统配置方面,`_USE_MKFS`允许使用f_mkfs函数来创建FAT文件系统,`_USE_FORWARD`则启用f_forward函数,用于在不使用数据缓冲区的情况下从文件中...

    1-how yaffs work.docx

    此外,Yaffs支持Unicode和ASCII操作,以适应不同语言和地区的需求。 - **简单性**:复杂性被最小化,只有在能显著提升性能或实用性的情况下才会引入。为了实现这一点,Yaffs采用了单一的线程模型,并且使用了日志...

    ODAC 4.5.2.19

    Oracle Data Access Components08-Oct-03 New features in ODAC 4.50-------------------------------------------------- - XMLTYPE datatype support added - WideString support added to work with Unicode ...

    FindStr_FindString_SearchUnicodeString_TheProgram_

    - **Work.cpp**:可能包含了程序的主要工作逻辑,如实际的字符串搜索算法。 - **FindStr.h**:这是一个头文件,可能包含了`FindStr`相关的函数声明和类定义。 - **resource.H**:这通常包含资源定义,如菜单、对话框...

    YuStemmer v3.6.2 for D4-XE7

    The Stem() method does the work for all of the above classes. It expects a single word and returns its stem. If there is no stem, the original word is returned unchanged. function StemFrench(const A...

    FTPRush 1.1.1.16 Unicode - Cracked

    A few lines of code will help you teach the program to execute lots of routine work automatically. This feature allows you to reach spectacular efficiency in no time. Another advantage of FTPRush is ...

    LuaUnicode icu-lua

    local _, count = string.gsub(unicode_string, "[^\128-\193]", "") If you want to know how many printing columns a Unicode string will occupy when you print it out using a fixed-width font (imagine ...

    basic_excel excel开源读写库[修正bug]

    开源basic_excel存在读excel文件时load异常,原因是对其中work表中WORKBOOK_GLOBALS的case CODE::SST组装存在bug,SST中存放全局的stting信息,当其长度超过8224时就需要拆分记录,新的记录标识位为[CODE::CONTINUE]...

    gc2145_tinav2.1验证完成20170523_1648.7z

    UNICODE 全志R16平台TINAV2.1下的CSI接口摄像头ov5640的配置v1.2.txt R16_Camera模块开发说明文档_V1.8.pdf 所有步骤请按照这个说明书执行 1、驱动的编译配置: R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\...

    Delphi2010皮肤控件AlphaControls6.21FS

    * Improvements in the unicode work, support of unicode was added into dialogs * Added new "Vista" skin 15.07.2008 AlphaControls v5.51 stable released * Solved problem with BorderIcons when form ...

    gtk键盘事件

    若要获取用户实际输入的字符,可能需要转换键码,这可以通过`gdk_keyval_to_unicode()`函数完成。 7. **国际化支持**:GTK+处理键盘事件时考虑了多种语言和布局,确保了键盘输入的正确性和一致性。 8. **示例代码*...

Global site tag (gtag.js) - Google Analytics