Recent

Author Topic: charset in Lazarus  (Read 6443 times)

Alf Wernersson

  • New Member
  • *
  • Posts: 17
charset in Lazarus
« on: June 28, 2021, 08:19:15 pm »
Which charset shall I use in MariaDb or MySQl receive swedish letter "åäöÅÄÖ" when viewing a table in Lazarus. Is it possible change charset in Lazarus?

Regards
Alf

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: charset in Lazarus
« Reply #1 on: June 28, 2021, 08:44:38 pm »
Doesn't that depend on the charset used in the database?
If that is not UTF-8 you might have to "translate" to UTF-8 when trying to display it (since Lazarus/LCL is UTF-8 based).

Bart

Alf Wernersson

  • New Member
  • *
  • Posts: 17
Re: charset in Lazarus
« Reply #2 on: June 28, 2021, 09:54:43 pm »
Thanks for your answer Bart!

In both a test database and test table (MariaDB) I have set charset utf8_general_ci. In both terminal (ubuntu) and SqlYog I get "åäö" on "Select * from tbl2". But in Lazarus program I get 3 "squares".
Any more ideas......?
« Last Edit: June 28, 2021, 09:59:23 pm by Alf Wernersson »

Fantablup

  • Full Member
  • ***
  • Posts: 171
Re: charset in Lazarus
« Reply #3 on: June 29, 2021, 12:25:42 am »
What db components do you use?

If Zeos, it should not be problem. But other components can be different.

Alf Wernersson

  • New Member
  • *
  • Posts: 17
Re: charset in Lazarus
« Reply #4 on: June 29, 2021, 06:25:59 am »
Hello! I am using the components which comes with Lazarus.

    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    MySQL57Connection1: TMySQL57Connection;
    SQLQuery1: TSQLQuery;
    SQLTransaction1: TSQLTransaction;     

I have not found any possibility set charsets in them.   


Fantablup

  • Full Member
  • ***
  • Posts: 171
Re: charset in Lazarus
« Reply #5 on: June 29, 2021, 08:58:49 am »
I recommend using Zeos components.
You can install them via the online package manager. Easy as a cake.
Just go to package in the menu at the top in Lazarus and there you see it.

I would not use anything else than Zeos.

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: charset in Lazarus
« Reply #6 on: June 29, 2021, 09:31:42 am »
Hello! I am using the components which comes with Lazarus.

    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    MySQL57Connection1: TMySQL57Connection;
    SQLQuery1: TSQLQuery;
    SQLTransaction1: TSQLTransaction;     

I have not found any possibility set charsets in them.   

??????????
https://www.freepascal.org/docs-html/current/fcl/sqldb/tsqlconnection.charset.html
Considering TMySQL57Connection inherits from TSQLConnection

EDIT: It's even in the Object Inspector for the visual components

« Last Edit: June 29, 2021, 11:57:08 am by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018