Browse Source

* ensure that sysutils.expandfilename() returns its result in
DefaultRTLFileSystemCodePage instead of in DefaultFileSystemCodePage
(mantis #26627)

git-svn-id: trunk@28570 -

Jonas Maebe 11 years ago
parent
commit
88d969f3bd
3 changed files with 21 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 4 1
      rtl/inc/fexpand.inc
  3. 16 0
      tests/webtbs/tw26627.pp

+ 1 - 0
.gitattributes

@@ -14067,6 +14067,7 @@ tests/webtbs/tw2649.pp svneol=native#text/plain
 tests/webtbs/tw2651.pp svneol=native#text/plain
 tests/webtbs/tw2656.pp svneol=native#text/plain
 tests/webtbs/tw2659.pp svneol=native#text/plain
+tests/webtbs/tw26627.pp -text svneol=native#text/plain
 tests/webtbs/tw2666.pp svneol=native#text/plain
 tests/webtbs/tw2668.pp svneol=native#text/plain
 tests/webtbs/tw2669.pp svneol=native#text/plain

+ 4 - 1
rtl/inc/fexpand.inc

@@ -599,7 +599,10 @@ begin
                                                                            then
         Delete (PA,length(PA),1);
 {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
-
+{$IF defined(FPC_FEXPAND_SYSUTILS) and not defined(SYSUTILSUNICODE)}
+    { return result in expected code page }
+    SetCodePage(Pa,DefaultRTLFileSystemCodePage);
+{$ENDIF FPC_FEXPAND_SYSUTILS and not SYSUTILSUNICODE}
     FExpand := Pa;
 end;
 

+ 16 - 0
tests/webtbs/tw26627.pp

@@ -0,0 +1,16 @@
+program test;
+
+{$mode objfpc}{$h+}
+
+uses SysUtils;
+
+var a: ansistring;
+
+begin
+  defaultfilesystemcodepage:=CP_UTF8;
+  defaultrtlfilesystemcodepage:=CP_ASCII;
+  a := DirectorySeparator+'.';
+  a := ExpandFileName(a);
+  if StringCodePage(a)<> defaultrtlfilesystemcodepage then
+   halt(1);
+end.