How to --convert-to from .dbf( DOS/OS2-866/Russian) to .dbf (Windows-1251) ?
soffice.bin --headless --convert-to dbf my.dbf --infilter=dbf:34 --outdir D:\Temp\
//not works …
How to --convert-to from .dbf( DOS/OS2-866/Russian) to .dbf (Windows-1251) ?
soffice.bin --headless --convert-to dbf my.dbf --infilter=dbf:34 --outdir D:\Temp\
//not works …
dBase filter takes a single parameter: a number of the encoding (called “character set” in the documentation page).
So your command line would be:
soffice --infilter=dBASE:30 --convert-to dbf:dBASE:34 --outdir D:\Temp\ my.dbf
… but note that LibreOffice is hardly a proper dBase-editing application, and I wouldn’t be terribly surprised to learn that this conversion resulted in some problems, like changed types of fields and the like. LibreOffice imports the DBF into Calc (as a spreadsheet), and then exports the spreadsheet into DBF. What will happen in this double conversion with intermediate representation being a spreadsheet is … unclear
Error: Please verify input parameters… (SfxBaseModel::impl_store <file:///D:/T
emp/1.dbf> failed: 0x4040c03(Error Dynamic))
You didn’t show the exact command, so I have no idea why it is failing for you. Also you didn’t mention your LibreOffice version, and your OS (although it’s clear it’s some Windows).
To make your command and error to be shown as is, without the site thinking your <
or *
denote some formatting, enclose your strings into backticks `.
v: 6.3.2.2 (x64) Win 8.1 x64
file was created, but it is empty
c:\Program Files\LibreOffice\program>soffice --infilter=dBASE:30 --convert-to db f:dBASE:34 --outdir D:\Temp\DBF\1\ D:\Temp\DBF\gek-1_2200_240221.dbf convert D:\Temp\DBF\gek-1_2200_240221.dbf -> D:\Temp\DBF\1\gek-1_2200_240221.dbf using filter : dBASE:34 Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///D:/T emp/DBF/1/gek-1_2200_240221.dbf> failed: 0x4040c03(Error Dynamic))
The command line looks correct. I have tested a similar commend locally:
D:\lo\parallel\lo\6.3.0.4-x64\program\soffice --infilter=dBASE:76 --convert-to dbf:dBASE:34 --outdir D:\Documents\empty111\ D:\Documents\123.dbf
This produced a simple output:
convert D:\Documents\123.dbf -> D:\Documents\empty111\123.dbf using filter : dBASE:34
… success. But I tested with a simple DBF that I created in Calc; maybe you just have some problem unrelated to the command line, and it’s some filter limitation. Does this specific file save correctly when you do that interactively in UI?
this command works, and file was created , but text is not encoded
soffice --headless --infilter=dbf:dBASE:30 --convert-to dbf:dBASE:34 --outdir D:\Temp\DBF\1\ D:\Temp\DBF\gek-1_2200_240221.dbf
files are generated by a developer from another organization (not used Libre )
You did not tell if you succeed when using GUI interactively. It looks like there’s some problem with the content (since it works when you do not use correct filter in --infilter
, which in that form simply does nothing).
Maybe you could provide a sample DBF…
dbf
https://drive.google.com/file/d/1qVyUTsAyFQQK8st7Tt0_ylpqN_gitaHd/view?usp=sharing
At the beginning of the post, I did not express myself correctly, I need to make 866 from the encoding 1251. But it does not change the essence of the matter, since it does not work.
But it does not change the essence of the matter, since it does not work
But what does matter is my repeated question: “Does this specific file save correctly when you do that interactively in UI?”
And yes, it is the problem. If you open in LO the file you provided (specifying Win-1251), and try to save ad DBF with CP-866, you get this:
Error saving the document gek-1_2200_240221:
Write Error.
Cell B2 contains characters that are not representable in the selected target character set "Cyrillic (DOS/OS2-866/Russian)".
So yes, this conversion is impossible.
I don’t know how the creator of the file does it. I need to process it. thanks for the answers Mike !
There’s nothing cryptic in how the file was created. It includes a character і
in B2
(U+0456), and it is representable in CP-1251 (code B3
), but not in CP-866. The creator likely uses CP-1251 (or Unicode) to store the data, and puts there what they have. You just try to use a poor encoding (CP-866) for some reason.
Note that you also would not be able to use UTF-8 easily, because that encoding needs two bytes for each Cyrillic character, and that would exceed DBF field length.
Not all characters of the DOS/OS2-866 character set can be encoded in a Windows-1251 character set. If the document uses such than conversion rightfully refuses to do so. There’s nothing you can do other than replacing the offending characters (rewriting cell content) with some that are present in Windows-1251 set.
… and the opposite is also true, since @Trey1 clarified that there was a mistake in the question, and the actual task was to convert CP-1251 into CP-866.
Should be
soffice --headless --convert-to dbf:dBase:34 --infilter=dBase:30 ...
Note that the filter name is not the file name extension and you got the infilter character set cross.
See also possible character sets and this RFE comment I just added as pointer to available filter names.
soffice.bin --headless --convert-to dbf D:\Temp\1.dbf --infilter=dbf:34 --outdir D:\Temp\DBF\1\ Overwriting: D:/Temp/1.dbf Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///D:/Temp/1.dbf> failed: 0x4040c03(Error Dynamic))