mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 11:39:27 +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}
|
||||
dstchangeable:=false;
|
||||
pdst:=PAnsiChar(s);
|
||||
if StringCodePage(s)<>DefaultFileSystemCodePage then
|
||||
if TranslatePlaceholderCP(StringCodePage(s))<>DefaultFileSystemCodePage then
|
||||
begin
|
||||
fs:=ToSingleByteFileSystemEncodedFileName(s);
|
||||
pdst:=PAnsiChar(fs);
|
||||
@ -598,7 +598,7 @@ end;
|
||||
procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
|
||||
begin
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
TextRec(T).CodePage:=CodePage;
|
||||
TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
@ -845,7 +845,7 @@ begin
|
||||
if SLen > 0 then
|
||||
begin
|
||||
{$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
|
||||
a:=fpc_AnsiStr_To_AnsiStr(S,TextRec(f).CodePage);
|
||||
fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
|
||||
|
Loading…
Reference in New Issue
Block a user