Articles Charset Firebird 3.0 [malformed string error] - (maybe for another Databases) by Ivan Revelli

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,438
Credits
573
Charset Firebird 3.0 [malformed string error] - (maybe for another Databases) by Ivan Revelli
on May 2, 2020 - Ivan Revelli
[SHOWTOGROUPS=4,20]
images.png

Character set encoding In Firebird 3.0, as is known in a field of a varchar or char type table, it is possible to define the type of encoding managed, or not specific.

Through Firebird it is possible to record the content of the story from one set of characters and another simply with the SQL “cast” statement.

Let’s take an example, in my table “typologies_articles”, I have a “description” field to which I had not specified the encoding and basic in importing data in ISO8859_1 format, at the time of the development of my Web service I realize that my application it’s all homogeneous in UTF8 and I don’t want an application layer for conversion.

At this point I can execute the following instruction to convert the contents of the “DESCRIZONE” field from ISO8859_1 to UTF8.
Example of conversion from ISO8859-1 to UTF-8:

1
2
UPDATE tipologie_articoli
SET DESCRIZIONE = CAST(CAST(DESCRIZIONE AS varchar(200) character set ISO8859_1) AS varchar(200) character set UTF8)

If instead we had defined the “DESCRIPTION” field with the UTF8 charset when importing the data in ISO8859_1 format it would have given the “malformed string error” error.

[/SHOWTOGROUPS]