Merge pull request #1023 from RaiKoHoff/Dev_UCHARDET

Revert remapping of UCHARDET's GB18030 encoding predections - …
This commit is contained in:
Rainer Kottenhoff 2019-03-11 00:26:13 +01:00 committed by GitHub
commit ebc2531eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -7973,15 +7973,14 @@ static void _SetFileVars(char* lpData, char* tch, LPFILEVARS lpfv)
//
// FileVars_Init()
//
bool FileVars_Init(char *lpData, DWORD cbData, LPFILEVARS lpfv) {
char tch[LARGE_BUFFER];
ZeroMemory(lpfv,sizeof(FILEVARS));
if ((Flags.NoFileVariables && Settings.NoEncodingTags) || !lpData || !cbData)
if ((Flags.NoFileVariables && Settings.NoEncodingTags) || !lpData || !cbData) {
return true;
}
StringCchCopyNA(tch,COUNTOF(tch),lpData,min_s(cbData + 1,COUNTOF(tch)));
_SetFileVars(lpData, tch, lpfv);
@ -7990,8 +7989,9 @@ bool FileVars_Init(char *lpData, DWORD cbData, LPFILEVARS lpfv) {
_SetFileVars(lpData, tch, lpfv);
}
if (lpfv->mask & FV_ENCODING)
if (lpfv->mask & FV_ENCODING) {
lpfv->iEncoding = Encoding_MatchA(lpfv->tchEncoding);
}
return true;
}

View File

@ -722,6 +722,7 @@ extern "C" int Encoding_AnalyzeText
float const ucd_confidence = ucd_cnf;
float const ced_confidence = ced_cnf;
#if FALSE
// --------------------------------------------------------------------------
// GB18030 (UCD always) to GBK detection adjustment
// --------------------------------------------------------------------------
@ -741,7 +742,7 @@ extern "C" int Encoding_AnalyzeText
break;
}
}
#endif
// --------------------------------------------------------------------------
// vote for encoding prognosis based on confidence levels or reliability

View File

@ -164,7 +164,7 @@ typedef struct _filevars
bool bTabIndents;
bool fWordWrap;
int iLongLinesLimit;
char tchEncoding[32];
char tchEncoding[64];
int iEncoding;
char tchMode[32];