From 5123a7c9698d26d0bb271de2f867c4b08a351140 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Mon, 11 Mar 2019 00:19:05 +0100 Subject: [PATCH] + fix: revert remapping of UCHARDET's GB18030 encoding predections - rely on detectors --- src/Edit.c | 8 ++++---- src/EncodingDetection.cpp | 3 ++- src/TypeDefs.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index b5cdaff54..c7b232da6 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -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; } diff --git a/src/EncodingDetection.cpp b/src/EncodingDetection.cpp index d8cdef41c..8e27b7041 100644 --- a/src/EncodingDetection.cpp +++ b/src/EncodingDetection.cpp @@ -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 diff --git a/src/TypeDefs.h b/src/TypeDefs.h index f0ddbcdfe..5b590621e 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -164,7 +164,7 @@ typedef struct _filevars bool bTabIndents; bool fWordWrap; int iLongLinesLimit; - char tchEncoding[32]; + char tchEncoding[64]; int iEncoding; char tchMode[32];