Page 1 of 1
Multibyte character filename of exported csv filename
Posted: 09.08.2024, 03:50
by meeeeeeeeee
Hello. I use 7.2.14-release and Lazarus 2.2.6. I want to export to csv file with Multibyte character filename.
But the filename is garbled.
with "Utf8ToAnsi" csv file was saved as "縺ゅ≠.csv"
with "WinCpToUtf8" csv file was saved as "邵コ繧・旺.csv"
I want to save as "ああ.csv".
Is there any tips?
Code: Select all
ZReadOnlyQuery1.SQL.Add('select * into outfile "'+WinCpToUtf8('c:/works/ああ.csv')+'" from information_schema.columns WHERE table_schema="information_schema" and table_name="files"');
ZReadOnlyQuery1.ExecSQL;
ZReadOnlyQuery1.Close;
Re: Multibyte character filename of exported csv filename
Posted: 11.08.2024, 09:44
by marsupilami
Hello,
meeeeeeeeee wrote: ↑09.08.2024, 03:50
I use 7.2.14-release and Lazarus 2.2.6.
Please switch to more modern versions.
meeeeeeeeee wrote: ↑09.08.2024, 03:50
I want to export to csv file with Multibyte character filename.
But the filename is garbled.
with "Utf8ToAnsi" csv file was saved as "縺ゅ≠.csv"
with "WinCpToUtf8" csv file was saved as "邵コ繧・旺.csv"
I want to save as "ああ.csv".
Is there any tips?
Code: Select all
ZReadOnlyQuery1.SQL.Add('select * into outfile "'+WinCpToUtf8('c:/works/ああ.csv')+'" from information_schema.columns WHERE table_schema="information_schema" and table_name="files"');
ZReadOnlyQuery1.ExecSQL;
ZReadOnlyQuery1.Close;
I think, you don't need to call WinCpToUtf8 because according to
the FPC / Lazarus Wiki Lazarus will generate UTF-8 encoded files:
Sources should be saved in UTF-8 encoding. Lazarus creates such files by default. You can change the encoding of imported files via right click in source editor / File Settings / Encoding.
Does it work, if you remove the call to WinCpToUtf8?
Re: Multibyte character filename of exported csv filename
Posted: 21.08.2024, 02:44
by meeeeeeeeee
Hello. I tried with Lazarus v3.2 and ZeosLib 8.0.1-beta.
The file is UTF-8 encoded, and it is fine, but
I just care about the filename.
Alphabet letter filename is ok, but if I use multibyte character filename, the filename is strange.
It is not allowed to use Chinese character or Hiragana as a filename when I export as csv filename?
Re: Multibyte character filename of exported csv filename
Posted: 21.08.2024, 03:43
by meeeeeeeeee
I simply renamed the filename.
Code: Select all
ZReadOnlyQuery1.SQL.Add('select * into outfile "'+'c:/works/aa.csv'+'" from information_schema.columns WHERE table_schema="information_schema" and table_name="files"');
ZReadOnlyQuery1.ExecSQL;
ZReadOnlyQuery1.Close;
RenameFile('c:/works/aa.csv', 'c:/works/ああ.csv');