nonelatine charcter with mydac on ubuntu 15.04 server

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
drama22
Posts: 6
Joined: Sun 24 Jul 2016 01:27

nonelatine charcter with mydac on ubuntu 15.04 server

Post by drama22 » Sun 24 Jul 2016 01:39

i was using mydac on windows for a while without any issue with none latine charcter , but when i decided to change the platform of my application to work under ubuntu the none latine charcters comes out as question marks any idea why ?

here is a sample code that work normal on windows but on ubuntu its inserts question marks

Code: Select all

procedure TConnection.Registerdatadb(const usernamereg: String; const passwordreg: string);
var
dbconnect: TMyConnection;
begin
  TThread.Synchronize(nil,
    procedure
    var
      List: TList; // or TIdContextList if using a modern Indy version
      I: integer;
      Connection: TConnection;
    begin
      try

  dbconnect := TMyConnection.Create(nil);
  dbconnect.Pooling := true;
  dbconnect.PoolingOptions.Validate := true;
  dbconnect.Server := DATABASESERVERLOGIN;
  dbconnect.username := Databaseuserlogin;
  dbconnect.Password := Databasepassword;
  dbconnect.ConnectionTimeout := 0;
  connectionmo.userslq.Connection := dbconnect;
  dbconnect.Database := Dbname;
  dbconnect.Connect;

        if usernamereg <> '' then
        begin
          connectionmo.userslq.Close;
          connectionmo.userslq.SQL.Clear;
          connectionmo.userslq.SQL.Add
            ('SELECT * FROM `users` WHERE `username` = "' +
            trim(usernamereg) + '"');
          connectionmo.userslq.Open;
          if not connectionmo.userslq.IsEmpty then
          begin
            Exit;
          end
          else
          begin
            connectionmo.userslq.Close;
            connectionmo.userslq.SQL.Clear;
            connectionmo.userslq.SQL.Add
              ('INSERT INTO `users` (`username`, `password`) VALUES (:uname, :pass);');
            connectionmo.userslq.ParamByName('uname').AsString := trim(usernamereg);
            connectionmo.userslq.ParamByName('pass').AsString := trim(passwordreg);
            connectionmo.userslq.ExecSQL;
            connectionmo.userslq.Close;
          end;
        end;
      finally
        dbconnect.Disconnect;
        dbconnect.Free;
      end;
    end);
end;
username is equal to some arabic charcters so when its inserts on ubuntu it comes out question marks i checked the username value before insert its actual arabic chars after insert they become question marks what iam doing wrong ?

mydac version 8.4.11
Last edited by drama22 on Tue 26 Jul 2016 05:54, edited 1 time in total.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: nonelatine charcter with mydac on ubuntu 15.04 server

Post by ViktorV » Mon 25 Jul 2016 10:13

To solve the issue, please try to set the TMyConnection.Options.UseUnicode property to True. For example:

Code: Select all

  MyConnection.Options.UseUnicode := True;

Post Reply