コード例 #1
0
ファイル: zgui.cpp プロジェクト: OpenMagx/open-magx-src
int ZGui::checkCodec(char* chars, int len, int codeId)
{
	if ( codeId == 7 ) //if big5 codec
		return big5HeuristicContentMatch( chars, len );
	
    QTextCodec* codec = codecByLocalId(codeId);
    
    if ( !codec ) { printf("Error: Codec %d not found!!",codeId); return -1; };
    
    int col = codec->heuristicContentMatch(chars,len);
    
    if ( codeId > 0 )
    	if ( len != strlen(chars) )
    		if ( col )
    			col--;
    		
    return col;
}
コード例 #2
0
int UtilsCode::checkCodec(char* chars, int len, int codeId)
{
	//cout<<"==== checkCodec "<<endl;
	
	if ( codeId == 8 ) //if big5 codec
		return big5HeuristicContentMatch( chars, len );
	
    QTextCodec* codec = codecByLocalId(codeId);
    
    if ( !codec ) { 
		printf("Error: Codec %d not found!!", codeId);
		return -1; 
	}
    
    int col = codec->heuristicContentMatch(chars,len);
    
    if ( codeId > 0 ) {
    	if ( len != strlen(chars) ) {
    		if ( col )
    			col--;
		}		
    }		
    return col;
}