Multibyte character filename of exported csv filename

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
meeeeeeeeee
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 23.04.2024, 07:00

Multibyte character filename of exported csv filename

Post 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;

marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Multibyte character filename of exported csv filename

Post 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?
meeeeeeeeee
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 23.04.2024, 07:00

Re: Multibyte character filename of exported csv filename

Post 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?
meeeeeeeeee
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 23.04.2024, 07:00

Re: Multibyte character filename of exported csv filename

Post 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');
Post Reply