fpspreadsheet: Use UTF8 with BOM as default encoding for CSV reader/writer (better compatibility with Excel/LOCalc, see https://forum.lazarus.freepascal.org/index.php/topic,40527.msg280025.html#msg280025)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6257 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
d87367be7a
commit
15a617af53
@ -97,6 +97,9 @@ uses
|
||||
DateUtils, LConvEncoding, Math,
|
||||
fpsUtils, fpsNumFormat;
|
||||
|
||||
const
|
||||
DEFAULT_ENCODING = 'utf8bom';
|
||||
|
||||
function LineEndingAsString(ALineEnding: TsCSVLineEnding): String;
|
||||
begin
|
||||
case ALineEnding of
|
||||
@ -198,6 +201,8 @@ begin
|
||||
encoding := GuessEncoding(s)
|
||||
else
|
||||
encoding := CSVParams.Encoding;
|
||||
if encoding = '' then
|
||||
encoding := DEFAULT_ENCODING;
|
||||
|
||||
// Create worksheet
|
||||
FWorksheet := FWorkbook.AddWorksheet(FWorksheetName, true);
|
||||
@ -256,7 +261,7 @@ begin
|
||||
FFormatSettings := CSVParams.FormatSettings;
|
||||
ReplaceFormatSettings(FFormatSettings, FWorkbook.FormatSettings);
|
||||
if CSVParams.Encoding = '' then
|
||||
FEncoding := 'utf8'
|
||||
FEncoding := DEFAULT_ENCODING
|
||||
else
|
||||
FEncoding := CSVParams.Encoding;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user