mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 07:16:49 +02:00
lazutils: UTF8ToWinCP for Unix
git-svn-id: trunk@50723 -
This commit is contained in:
parent
01acb9a1bc
commit
b48a3ea89e
@ -52,13 +52,12 @@ function SysToUTF8(const AFormatSettings: TFormatSettings): TFormatSettings; ove
|
|||||||
function ConsoleToUTF8(const s: string): string;
|
function ConsoleToUTF8(const s: string): string;
|
||||||
// converts UTF8 string to console encoding (used by Write, WriteLn)
|
// converts UTF8 string to console encoding (used by Write, WriteLn)
|
||||||
function UTF8ToConsole(const s: string): string;
|
function UTF8ToConsole(const s: string): string;
|
||||||
{$IFDEF MSWindows}
|
|
||||||
// for all Windows supporting 8bit codepages (e.g. not WinCE)
|
// for all Windows supporting 8bit codepages (e.g. not WinCE)
|
||||||
// converts string in Windows code page to UTF8 (used with some Windows specific functions)
|
// converts string in Windows code page to UTF8 (used with some Windows specific functions)
|
||||||
function WinCPToUTF8(const s: string): string;
|
function WinCPToUTF8(const s: string): string;
|
||||||
// converts UTF8 string to Windows code page encoding (used by Write, WriteLn)
|
// converts UTF8 string to Windows code page encoding (used by Write, WriteLn)
|
||||||
function UTF8ToWinCP(const s: string): string;
|
function UTF8ToWinCP(const s: string): string;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
function ParamStrUTF8(Param: Integer): string;
|
function ParamStrUTF8(Param: Integer): string;
|
||||||
|
|
||||||
@ -315,6 +314,29 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function WinCPToUTF8(const s: string): string;
|
||||||
|
begin
|
||||||
|
if NeedRTLAnsi and (not IsASCII(s)) then
|
||||||
|
begin
|
||||||
|
Result:=AnsiToUTF8(s);
|
||||||
|
{$ifdef FPC_HAS_CPSTRING}
|
||||||
|
// prevent UTF8 codepage appear in the strings - we don't need codepage
|
||||||
|
// conversion magic in LCL code
|
||||||
|
SetCodePage(RawByteString(Result), StringCodePage(s), False);
|
||||||
|
{$endif}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function UTF8ToWinCP(const s: string): string;
|
||||||
|
begin
|
||||||
|
if NeedRTLAnsi and (not IsASCII(s)) then
|
||||||
|
Result:=UTF8ToAnsi(s)
|
||||||
|
else
|
||||||
|
Result:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
function GetEnvironmentStringUTF8(Index: Integer): string;
|
function GetEnvironmentStringUTF8(Index: Integer): string;
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC_RTL_UNICODE}
|
{$IFDEF FPC_RTL_UNICODE}
|
||||||
|
Loading…
Reference in New Issue
Block a user