CRO_Tomislav 0 Posted August 14, 2020 I have a Delphi project for an Android device. On a form I add UniConnection1,Uniquery1 and Edi1. I set up parameters for UniConnection and I can successfully connect do MariaDB On MariaDB I have a database encoded to UTF-8 In a code; when I make connection and use for example in UniQuery1: SELECT * FROM customers WHERE location='CROATIA' (I will receive only one record – it is OK) and when I assign in a code Edit1.Text := UniQuery1.FieldByName('customer_name').AsString; I see field contest in Edi1 without some special Croatian characters, for example 'š' I try to set UniCode = True, also with combination of setting character set = utf8; not show special characters... Exampl.: ... UniConnection1.Connect; If NOT uniConnection1.Connected then ShowMessage('#0 – NO CONNECTION TO DB!') else begin with UniQuery1 do begin Close; SQL.Clear; SQL.Text:= 'SELECT * FROM customers WHERE location=' + QuotedStr('CROATIA'); Open; end; Edit1.Text:=UniQuery1.FieldByName('').AsSring; end; ... Any idea? With best regards Tomislav Share this post Link to post
Guest Posted August 14, 2020 Not sure for MariaDB but i always use this with MySql, try the second line only from the following or both should solve your problem. And remember to check what your table has as charset, and make it identical to the following to, if not then redesign/alter your table accordingly. aUniConnection.SpecificOptions.Values['Charset'] := 'utf8mb4'; aUniConnection.SpecificOptions.Values['UseUnicode'] := 'True'; utf8mb4 will give the ability to store any char, so it is the best, at least for me. Share this post Link to post
Guest Posted August 14, 2020 (edited) Then two questions goes here: 1) Please run this and make sure that the table has utf8 as charset, if not then share with us here. Quote SHOW CREATE TABLE customers 2) Are you using Delphi 2009 (or newer) or an ansistring Delphi like D2007, in the older version you need to use AsWideString instead of AsString. Edited August 14, 2020 by Guest Share this post Link to post
CRO_Tomislav 0 Posted August 14, 2020 (edited) Hello. Yes, table it has as charset and I use delphi 10.3.3. I make a clon of table and set it to cp1250 and now is ok... With best regards Tomislav Edited August 14, 2020 by CRO_Tomislav "clon" - type feler Share this post Link to post
Guest Posted August 14, 2020 You have solved your problem, that is good, but keep in mind your application will not work the same on different PC with different Windows language settings. Share this post Link to post