Subject Re: [firebird-support] iso 8859-1
Author Brad Pepers
Milan Babuskov wrote:
> Luiz Rafael Culik Guimaraes wrote:
>
>>is wheir an way to tell firebird to use iso8859-1 codepage with dialect 3
>>when using firebird c api
>
>
> There is. However, I don't know how it is done, since I work with IBPP (a thin C++ layer around C
> API). But, since it's open source, you can donwload and find the answer yourself. IBPP code is very
> well structured and easily readable, so I'm sure you will find it quickly.

As far as I understand you need to do two things to use iso8859-1:

1. When you create the database you need to specify:

default character set ISO8859_1

2. When you connect using isc_attach_database you need to specify the
isc_dpb_lc_ctype in your database parameter block. So some code like this:

// Add character set
const char* charSet = "ISO8859_1";
*dpb++ = isc_dpb_lc_ctype;
*dpb++ = strlen(charSet);
strcpy(dpb, charSet);
dpb += strlen(charSet);

Its seems this is all you have to do since I recently tried to figure it
all out and with the above two things it all seems to be working. You
need to make sure then that the strings you pass to Firebird are using
the iso8859-1 encoding and that your software expects iso8859-1 encoded
strings back from the database.

Its a shame that Firebird doesn't support UTF-8 as well as some other
database I was using (PostgreSQL and Sybase ASA for instance) though
using UTF-8 does have a speed penalty it does make things easier when
working with any possible character set out there and makes the
interface between a package using all Unicode internally and the
database easier.

--
Brad Pepers
brad@...