diff --git a/source/helpers.pas b/source/helpers.pas index 311c9e7a..1527f0ff 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -327,7 +327,6 @@ type var AppSettings: TAppSettings; MutexHandle: THandle = 0; - ASCIIEncoding: TEncoding; implementation @@ -2449,7 +2448,7 @@ begin Result := ''; if Encoding = TEncoding.Default then Result := 'Windows-'+IntToStr(GetACP) - else if Encoding = ASCIIEncoding then + else if Encoding.CodePage = 437 then Result := 'ascii' else if Encoding = TEncoding.Unicode then Result := 'utf-16le' diff --git a/source/main.pas b/source/main.pas index 038fe315..6cdbf3db 100644 --- a/source/main.pas +++ b/source/main.pas @@ -1580,7 +1580,6 @@ begin FTreeRefreshInProgress := False; FileEncodings := Explode(',', 'Auto detect (may fail),ANSI,ASCII,Unicode,Unicode Big Endian,UTF-8,UTF-7'); - ASCIIEncoding := TEncoding.GetEncoding(437); end; @@ -10118,11 +10117,13 @@ end; function TMainForm.GetEncodingByName(Name: String): TEncoding; +var + Enc: TEncoding; begin Result := nil; case FileEncodings.IndexOf(Name) of 1: Result := TEncoding.Default; - 2: Result := ASCIIEncoding; + 2: Result := TEncoding.GetEncoding(437); 3: Result := TEncoding.Unicode; 4: Result := TEncoding.BigEndianUnicode; 5: Result := TEncoding.UTF8; @@ -10136,7 +10137,7 @@ var idx: Integer; begin if Encoding = TEncoding.Default then idx := 1 - else if Encoding = ASCIIEncoding then idx := 2 + else if Encoding.CodePage = 437 then idx := 2 else if Encoding = TEncoding.Unicode then idx := 3 else if Encoding = TEncoding.BigEndianUnicode then idx := 4 else if Encoding = TEncoding.UTF8 then idx := 5 @@ -10201,7 +10202,7 @@ begin 54936: Result := 'gb18030'; 65001: Result := 'utf8'; end; - end else if Encoding = ASCIIEncoding then + end else if Encoding.CodePage = 437 then Result := 'ascii' else if Encoding = TEncoding.Unicode then Result := 'utf16le'