mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 20:09:18 +02:00
* call TranslatePlaceholderCP() when comparing code pages to avoid
unnecessary conversions between CP_ACP and the current actual DefaultSystemCodePage * call TranslatePlaceholderCP() when changing the code page of a text file because in some cases this code page is passed directly to widestringmanager.Wide2AnsiMoveProc() (which does not perform any translation itself) git-svn-id: trunk@26316 -
This commit is contained in:
parent
f69a76b5b1
commit
ddf08b4eb7
@ -307,7 +307,7 @@ Begin
|
|||||||
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
dstchangeable:=false;
|
dstchangeable:=false;
|
||||||
pdst:=PAnsiChar(s);
|
pdst:=PAnsiChar(s);
|
||||||
if StringCodePage(s)<>DefaultFileSystemCodePage then
|
if TranslatePlaceholderCP(StringCodePage(s))<>DefaultFileSystemCodePage then
|
||||||
begin
|
begin
|
||||||
fs:=ToSingleByteFileSystemEncodedFileName(s);
|
fs:=ToSingleByteFileSystemEncodedFileName(s);
|
||||||
pdst:=PAnsiChar(fs);
|
pdst:=PAnsiChar(fs);
|
||||||
@ -598,7 +598,7 @@ end;
|
|||||||
procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
|
procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
|
||||||
begin
|
begin
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
{$ifdef FPC_HAS_CPSTRING}
|
||||||
TextRec(T).CodePage:=CodePage;
|
TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -845,7 +845,7 @@ begin
|
|||||||
if SLen > 0 then
|
if SLen > 0 then
|
||||||
begin
|
begin
|
||||||
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
if TextRec(f).CodePage<>StringCodePage(S) then
|
if TextRec(f).CodePage<>TranslatePlaceholderCP(StringCodePage(S)) then
|
||||||
begin
|
begin
|
||||||
a:=fpc_AnsiStr_To_AnsiStr(S,TextRec(f).CodePage);
|
a:=fpc_AnsiStr_To_AnsiStr(S,TextRec(f).CodePage);
|
||||||
fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
|
fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
|
||||||
|
Loading…
Reference in New Issue
Block a user