Browse Source

* Patch from Werner Pamler to allow setting codepage on DBF export. Fixes issue #39728

Michaël Van Canneyt 1 month ago
parent
commit
74ae1dc6ca
1 changed files with 7 additions and 0 deletions
  1. 7 0
      packages/fcl-db/src/export/fpdbfexport.pp

+ 7 - 0
packages/fcl-db/src/export/fpdbfexport.pp

@@ -46,6 +46,7 @@ Type
   TDBFExportFormatSettings = class(TExportFormatSettings)
   private
     FAutoRename: Boolean;
+    FLanguageID: Byte;
     FTableFormat: TTableFormat;
   public
     Procedure Assign(Source : TPersistent); override;
@@ -53,6 +54,7 @@ Type
   Published
     Property TableFormat : TTableFormat Read FTableFormat Write FTableFormat;
     Property AutoRenameFields : Boolean Read FAutoRename Write FAutoRename;
+    Property LanguageID: Byte Read FLanguageID Write FLanguageID;
   end;
   { TFPCustomDBFExport }
 
@@ -214,6 +216,8 @@ begin
   Inherited;
   FDBF:=TDBF.Create(Self);
   FDBF.TableName:=FFileName;
+  if FormatSettings.LanguageID <> 0 then
+    FDBF.LanguageID := FormatSettings.LanguageID;
   FDBF.DefaultBufferCount:=2;
   FE:=FileExists(FFileName);
   If FAppendData and FE then
@@ -226,6 +230,7 @@ begin
         Raise EDataExporter.CreateFmt(SErrFailedToDeleteFile,[FFileName]);
       end;
     end;
+
 end;
 
 procedure TFPCustomDBFExport.DoAfterExecute;
@@ -302,6 +307,7 @@ begin
     begin
     FS:=Source as TDBFExportFormatSettings;
     AutoRenameFields:=FS.AutoRenameFields;
+    LanguageID := FS.LanguageID;
     TableFormat:=FS.TableFormat;
     end;
   inherited Assign(Source);
@@ -312,6 +318,7 @@ begin
   inherited InitSettings;
   FAutoRename:=true; // sensible to avoid duplicate table names
   FTableFormat:=tfDBaseIV; //often used
+  FLanguageID := 0;  // will be replaced by LanguageID of dbf to be exported
 end;
 
 end.