mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 10:39:22 +02:00
Implements GetConsoleTextEncoding for Windows
git-svn-id: trunk@33079 -
This commit is contained in:
parent
9cd742005b
commit
5f53fe15b9
@ -137,7 +137,9 @@ var EncodingValid: boolean = false;
|
|||||||
{$include asiancodepagefunctions.inc}
|
{$include asiancodepagefunctions.inc}
|
||||||
|
|
||||||
{$IFDEF Windows}
|
{$IFDEF Windows}
|
||||||
function GetWindowsEncoding: string;
|
// AConsole - If false, it is the general system encoding,
|
||||||
|
// if true, it is the console encoding
|
||||||
|
function GetWindowsEncoding(AConsole: Boolean = False): string;
|
||||||
var
|
var
|
||||||
cp : UINT;
|
cp : UINT;
|
||||||
{$IFDEF WinCE}
|
{$IFDEF WinCE}
|
||||||
@ -146,7 +148,9 @@ const
|
|||||||
CP_UTF8 = 65001;
|
CP_UTF8 = 65001;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
cp := GetACP;
|
if AConsole then cp := GetOEMCP
|
||||||
|
else cp := GetACP;
|
||||||
|
|
||||||
case cp of
|
case cp of
|
||||||
CP_UTF8: Result := EncodingUTF8;
|
CP_UTF8: Result := EncodingUTF8;
|
||||||
else
|
else
|
||||||
@ -204,8 +208,8 @@ end;
|
|||||||
function GetConsoleTextEncoding: string;
|
function GetConsoleTextEncoding: string;
|
||||||
begin
|
begin
|
||||||
{$ifdef Windows}
|
{$ifdef Windows}
|
||||||
// ToDo
|
Result:=GetWindowsEncoding(True);
|
||||||
Result := GetDefaultTextEncoding;
|
Result:=NormalizeEncoding(Result);
|
||||||
{$else}
|
{$else}
|
||||||
Result := GetDefaultTextEncoding;
|
Result := GetDefaultTextEncoding;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user