View Issue Details

IDProjectCategoryView StatusLast Update
0019441LazarusLCLpublic2011-06-02 05:59
ReporterSalvatore CoppolaAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows XpOS Version
Product Version0.9.30.1 (SVN)Product Build 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0019441: Grid SaveToFile and LoadFromFile (filename with in accented chars)
DescriptionGrid can't load a saved data in a file with in filename accented chars)

Steps To ReproduceJust try the attacched project (save and load a grid)
Additional InformationUnder Linux Ubuntu 11.04 this feature is ok
TagsNo tags attached.
Fixed in Revision31003
LazTarget0.99.0
WidgetsetWin32/Win64
Attached Files
  • testgrid.zip (129,283 bytes)
  • grids_r30977.patch (619 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 30979)
    +++ lcl/grids.pas	(working copy)
    @@ -8240,7 +8240,7 @@
     
       Cfg:=TXMLConfig.Create(nil);
       Try
    -    Cfg.FileName := FileName;
    +    Cfg.FileName := UTF8ToSys(FileName);
         SaveContent(Cfg);
       Finally
         Cfg.Flush;
    @@ -8296,7 +8296,7 @@
     
       Cfg:=TXMLConfig.Create(nil);
       Try
    -    Cfg.Filename := FileName;
    +    Cfg.Filename := UTF8ToSys(FileName);
         Version:=cfg.GetValue('grid/version',-1);
         if Version=-1 then raise Exception.Create(rsNotAValidGridFile);
         BeginUpdate;
    
    grids_r30977.patch (619 bytes)

Activities

2011-05-28 23:12

 

testgrid.zip (129,283 bytes)

Anton

2011-05-29 13:39

reporter   ~0048703

Salvatore Coppola, you are using non-correct windows path:
  '.'+DirectorySeparator+'\città.xml' = './\città.xml'
Character sequence "/\" is not allowed in windows' paths.
More over, it seems that grids.pas contains an error in TCustomGrid.SaveToFile cause TCustomGrid.SaveToFile regards FileName (its parameter) as UTF8 string and uses appropriate functions (FileExistsUTF8, DeleteFileUTF8) but TXMLConfig is a part of FCL so TXMLConfig.FileName is not regarded as UTF8 string. I think, grids.pas:8243 must be looked as:
    Cfg.FileName := Utf8ToSys(FileName);

Salvatore Coppola

2011-05-30 21:25

reporter   ~0048722

Yes, forgot '/' when replaced hard coded under linux, thanks for the hints

Maxim Ganetsky

2011-05-30 23:40

developer   ~0048723

Confirmed. Proposed patch is attached.

2011-05-30 23:40

 

grids_r30977.patch (619 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 30979)
+++ lcl/grids.pas	(working copy)
@@ -8240,7 +8240,7 @@
 
   Cfg:=TXMLConfig.Create(nil);
   Try
-    Cfg.FileName := FileName;
+    Cfg.FileName := UTF8ToSys(FileName);
     SaveContent(Cfg);
   Finally
     Cfg.Flush;
@@ -8296,7 +8296,7 @@
 
   Cfg:=TXMLConfig.Create(nil);
   Try
-    Cfg.Filename := FileName;
+    Cfg.Filename := UTF8ToSys(FileName);
     Version:=cfg.GetValue('grid/version',-1);
     if Version=-1 then raise Exception.Create(rsNotAValidGridFile);
     BeginUpdate;
grids_r30977.patch (619 bytes)

Jesus Reyes

2011-06-01 22:35

developer   ~0048744

Applied, thanks.

Issue History

Date Modified Username Field Change
2011-05-28 23:12 Salvatore Coppola New Issue
2011-05-28 23:12 Salvatore Coppola File Added: testgrid.zip
2011-05-28 23:12 Salvatore Coppola Widgetset => Win32/Win64
2011-05-29 13:39 Anton Note Added: 0048703
2011-05-30 21:25 Salvatore Coppola Note Added: 0048722
2011-05-30 23:40 Maxim Ganetsky LazTarget => 0.99.0
2011-05-30 23:40 Maxim Ganetsky Note Added: 0048723
2011-05-30 23:40 Maxim Ganetsky Assigned To => Jesus Reyes
2011-05-30 23:40 Maxim Ganetsky Status new => assigned
2011-05-30 23:40 Maxim Ganetsky Target Version => 0.99.0
2011-05-30 23:40 Maxim Ganetsky File Added: grids_r30977.patch
2011-06-01 22:35 Jesus Reyes Fixed in Revision => 31003
2011-06-01 22:35 Jesus Reyes Status assigned => resolved
2011-06-01 22:35 Jesus Reyes Fixed in Version => 0.9.31 (SVN)
2011-06-01 22:35 Jesus Reyes Resolution open => fixed
2011-06-01 22:35 Jesus Reyes Note Added: 0048744
2011-06-02 05:59 Salvatore Coppola Status resolved => closed