--- a/charconvfw/charconvplugins/src/plugins/big5.cpp Tue May 11 17:53:33 2010 +0300
+++ b/charconvfw/charconvplugins/src/plugins/big5.cpp Tue May 25 14:39:28 2010 +0300
@@ -97,6 +97,7 @@
TInt sumOfWeight=0; //sum of the weights of the chars which are included in the sample
TInt sumOutChar=0; //the number of chars which are not common
TInt sumOfBadSecondByte=0;//the number of chars whose first byte is in the range but not the second
+ TInt sumOfBadSingleByte=0; //the number of bad single byte, which is not in valid range
struct referenceChar
{
TUint charBig5;
@@ -156,11 +157,17 @@
sumOfBadSecondByte++;
}
}
+ // if seldom used characters
+ else if (aSample[i] < 0x20 || aSample[i] > 0x7F )
+ {
+ if (aSample[i]!=0x09 && aSample[i]!=0x0A && aSample[i]!=0x0D)
+ sumOfBadSingleByte++;
+ }
} // for
if (sumOfGoodChar)
{
- aConfidenceLevel=sumOfGoodChar*100/(sumOfBadSecondByte+sumOfGoodChar);
+ aConfidenceLevel=sumOfGoodChar*100/(sumOfBadSecondByte+sumOfGoodChar+sumOfBadSingleByte);
aConfidenceLevel=aConfidenceLevel-Max(0,((totalWeight-sumOfWeight)*sumOfGoodChar/1000));//against frequent chars
aConfidenceLevel=aConfidenceLevel-sumOutChar*100/sumOfGoodChar;//against gap
aConfidenceLevel=(aConfidenceLevel < 0)?0:aConfidenceLevel;