Hi out there,
I´m an old IB/FB wolf but a newie to UniDAC and UTF8. I created (FB 2.1) a database and table like this:
create database 'database.fdb' user 'SYSDBA' password 'masterkey'
page_size 16384
default character set UTF8;
create table USUARIOS (
USUARIO_ID
varchar(20) not null
constraint USUARIOS_PK primary key,
USUARIO_NOMBRE
varchar(80) not null
constraint USUARIO_NOMBRE_BLANCO check (USUARIO_NOMBRE '')
collate UTF8 .........
My connection has the specific options:
InterBase.Charset=UTF-8 (not the Unicode one since I´m using D2007 and don´t want to use WideStrings)
and so, I expect every string read to be converted to AnsiString and every written be converted to UTF8 but that is not working. I´m making wrong assumptions here? If I enter a string like "capitán" in the application I get a malformed string exception, and if I populate the table with an external tool, the string is shown with gibberish (but correct UTF8 encoded) characters
Regards,
Alvaro Castiello
Firebird 2.1 UTF8 trouble?
Hello,
To work with unicode data you should enable unicode support in the following way:
To work with unicode data you should enable unicode support in the following way:
Code: Select all
UniConnection.SpecificOptions.Values['UseUnicode'] := 'True';
-
- Posts: 7
- Joined: Tue 01 Feb 2011 16:21
Hi Andrey,AndreyZ wrote:Hello,
To work with unicode data you should enable unicode support in the following way:Code: Select all
UniConnection.SpecificOptions.Values['UseUnicode'] := 'True';
When I do that I get a field mistmach exception "actual string expecting widestring". My fields are not TStrngField but a descendant class. Also, does the solution you state implies that database columns should also be wide ones? I´m a little confused here
Note: If I encode/decode the fields by "hand" with AnsiToUTF8 and UTF8ToAnsi in get/set text events everything runs fine but certainly I don´t want to go to set such events to every TmgStringField, and for certain ones I certainly can´t since they have their own context specific get/set
When the UseUnicode option is set to True, UniDAC creates TWideStingField instead of TStringField. That is why after setting UseUnicode to True, you should remove persistent fields from your datasets and add them again.
Also please look at this topic: http://www.devart.com/forums/viewtopic. ... c&start=15
There you can find more information about unicode usage.
Also please look at this topic: http://www.devart.com/forums/viewtopic. ... c&start=15
There you can find more information about unicode usage.
-
- Posts: 7
- Joined: Tue 01 Feb 2011 16:21
That´s very bad news since I use a TStringField descendantAndreyZ wrote:When the UseUnicode option is set to True, UniDAC creates TWideStingField instead of TStringField. That is why after setting UseUnicode to True, you should remove persistent fields from your datasets and add them again.
Also please look at this topic: http://www.devart.com/forums/viewtopic. ... c&start=15
There you can find more information about unicode usage.


Regards,
Alvaro