Skip to content

Commit 79e4654

Browse files
committed
feat: re-enable codepage => charset mapping using GetACP from DelphiCompat unit
1 parent ad52dd3 commit 79e4654

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

source/apphelpers.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface
88
Classes, SysUtils, Generics.Collections, Controls, RegExpr, Math, FileUtil,
99
StrUtils, Graphics, GraphUtil, LCLIntf, Forms, Clipbrd, Process, ActnList, Menus, Dialogs,
1010
Character, DateUtils, laz.VirtualTrees, SynEdit, SynCompletion, fphttpclient,
11-
{$IFDEF WINDOWS} Windows, {$ENDIF}
11+
{$IFDEF WINDOWS} Windows, {$ENDIF} DelphiCompat,
1212
dbconnection, dbstructures, jsonregistry, lazaruscompat, fpjson, SynEditKeyCmds, LazFileUtils, gettext, LazUTF8,
1313
IniFiles, GraphType;
1414

@@ -2463,7 +2463,7 @@ function GetHTMLCharsetByEncoding(Encoding: TEncoding): String;
24632463
begin
24642464
Result := '';
24652465
if Encoding = TEncoding.Default then
2466-
Result := 'utf-8' // 'Windows-'+IntToStr(GetACP)
2466+
Result := 'Windows-'+IntToStr(GetACP)
24672467
else if Encoding.CodePage = 437 then
24682468
Result := 'ascii'
24692469
else if Encoding = TEncoding.Unicode then

source/main.pas

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13739,8 +13739,7 @@ function TMainForm.GetCharsetByEncoding(Encoding: TEncoding): String;
1373913739
Result := '';
1374013740
if Encoding = TEncoding.Default then begin
1374113741
// Listing taken from http://forge.mysql.com/worklog/task.php?id=1349
13742-
// This would require to use the Windows unit, which would cause conflicts with Beep
13743-
{case GetACP of
13742+
case GetACP of
1374413743
437: Result := 'cp850';
1374513744
850: Result := 'cp850';
1374613745
852: Result := 'cp852';
@@ -13789,7 +13788,7 @@ function TMainForm.GetCharsetByEncoding(Encoding: TEncoding): String;
1378913788
51950: Result := 'big5';
1379013789
54936: Result := 'gb18030';
1379113790
65001: Result := 'utf8';
13792-
end;}
13791+
end;
1379313792
end else if (Encoding <> nil) and (Encoding.CodePage = 437) then
1379413793
Result := 'ascii'
1379513794
else if Encoding = TEncoding.Unicode then

0 commit comments

Comments
 (0)