diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2021-01-02 16:39:39 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2021-01-02 16:39:39 +0000 |
commit | a0c9e947549c9363dca63e146daa969cbaf4f665 (patch) | |
tree | e784e2c98d91eb004d9ded569dcceb5680f219d4 /rtl/inc | |
parent | 5b85bef7c0033d3774afb58611bbf06462c11501 (diff) | |
download | fpc-a0c9e947549c9363dca63e146daa969cbaf4f665.tar.gz |
* fpc_AnsiStr_Concat: if one of the strings is empty and CP_NONE is passed, the code page
of the other string is taken, this is also like fpc_AnsiStr_Concat_multi works if length(sarr)=2
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47976 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/inc')
-rw-r--r-- | rtl/inc/astrings.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/rtl/inc/astrings.inc b/rtl/inc/astrings.inc index b26f1708ee..5941c99fd3 100644 --- a/rtl/inc/astrings.inc +++ b/rtl/inc/astrings.inc @@ -236,12 +236,16 @@ begin S2CP:=TranslatePlaceholderCP(S2CP); {$ifdef FPC_HAS_CPSTRING} { if the result is rawbytestring and both strings have the same code page, - keep that code page } - if (cp=CP_NONE) and - (S1CP=S2CP) then - DestCP:=S1CP; + keep that code page or keep the code page if the other string is empty } + if cp=CP_NONE then + begin + if (S1CP=S2CP) or (S2='') then + DestCP:=S1CP + else if S1='' then + DestCP:=S2CP; + end; {$endif FPC_HAS_CPSTRING} - if (S1CP<>DestCP) or (S2CP<>DestCP) then + if ((S1CP<>DestCP) and (s1<>'')) or ((S2CP<>DestCP) and (s2<>'')) then begin ansistr_concat_complex(DestS,S1,S2,DestCP); exit; |