#1 2012-09-16 09:00:30

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Unicode problem

Hi,

I'm not follow the last change on your frameworks.
I have start a new application develop with Delphi 2006 and I have update the frameworks with last build.
I have a strange problem: if I use UTF8ToString() the result string doesn't have some char like à, ò, ù, ...

For example:

  MyRecord := TSQLMyRecord.CreateAndFillPrepare(Database, '');
  try
    while MyRecord.FillOne do
      begin
        if MyRecord.ID <> 0 then
          begin
            MessageDlg(MyRecord.Titolo,mtError, [mbOK], 0); // GET RIGHT STRING TEXT: "qualità"
            MessageDlg(UTF8ToString(MyRecord.Titolo),mtError, [mbOK], 0); // GET BAD STRING TEXT: "qualit"
          end;
      end;
  finally
    MyRecord.Free;
  end;

Do you have change somethings on your framework? Any ideas?

Offline

#2 2012-09-16 20:27:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Unicode problem

i suspect your code is incorrect.

titolo field is already a string, not a rawutf8 - or you changed the field definition, but not the data...

Offline

#3 2012-09-16 21:54:24

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Unicode problem

Titolo is RawUTF8:

  TSQLMyRecord = class(TSQLRecord)
  private
    fTitolo: RawUTF8;
  published
    property Titolo: RawUTF8 read fTitolo write fTitolo;
  end;

I have create the databse by framework (so I think the data type is correct), then I have popolate the database by an external editor (http://sqliteadmin.orbmu2k.de/).

I just to it the same things when I have develop another application without problem, ...

Offline

#4 2012-09-17 13:54:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Unicode problem

If you get:

 MessageDlg(MyRecord.Titolo,mtError, [mbOK], 0); // GET RIGHT STRING TEXT: "qualità"

This means that this is not UTF-8 encoded, but WinAnsiString.
Under Delphi 2006, you should here have something like "qualitàç", i.e. an UTF-8 encoded string.
Your data is wrong in the db, I guess.

Offline

#5 2012-09-17 14:30:14

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Unicode problem

OK, it's possible add a IMPORT feature into SynDBExplorer to import from csv file. So I can avoid to use external SQLite editor.

Offline

Board footer

Powered by FluxBB