Subject Re: [firebird-support] FB2 - ISO8859_1 (PT_BR) x WIN1252 (WIN_PTBR)
Author Alexandre Benson Smith
Valdir Marcos wrote:
> Helen Borrie, The Firebird Book, 2004, USA, page 175:
>
> ISO8859_1 (LATIN_1) and WIN1252
> The Firebird ISO8859_1 character set is often specified to support European languages. ISO8859_1, also known as LATIN_1, is a proper subset of WIN1252: Microsoft added characters in positions that ISO specially defines as NOT A CHARACTER (not "undefined," but specially "not a character"). Firebird supports both WIN1252 and ISO8859_1. You can always transliterate ISO8859_1 to WIN1252, but transliterating WIN1252 to ISO8859_1 can result in errors.
>
> Carlos Henrique Cantu, Firebird 2, 2006, Brazil, page 125
> The ISO collations order by "dictionary sort technique" where the space and other accent characters are treated in a different way what results in a "strange ordering."
>
> Collations by Peter Gulutzan
> http://www.dbazine.com/db2/db2-disarticles/gulutzan1
>
>
> 1. Are those collateral effects of the ISO8859_1 character set (and PT_BR collate) ordering real? And if they are, do they still persist on Firebird 2?
>
> 2. Is there any problem in using the WIN1252 character set (and WIN_PTBR collate) on a Debian Linux Server? The clients will be Linux with Java and C++ desktop applications and Windows XP Pro with Java and Delphi 7 desktop applications.
>
> Best regards,
>
> Valdir
>

Valdir,

I don't know about the "collateral effects". I think some collations
could "ignore" the space on sorting/comparing, so "A CB" could sort
after "ABC", I think PT_PT has this feature, PT_BR sorts spaces before
the chars.

I do use ISO8859_1 with collate PT_BR for some years (even when it's not
part of FB main branch and was implemented on FB PT_BR variation), had
never had any kind of trouble.

some examples:
create table foo(
a varchar(10) character set iso8859_1 collate pt_br,
b varchar(10) character set iso8859_1 collate pt_pt,
c varchar(10) character set win1252 collate win_ptbr
);
commit;

insert into foo (a) values('abc');
insert into foo (a) values('a bc');
insert into foo (a) values('ab c');
insert into foo (a) values('a b c');
insert into foo (a) values('acb');
insert into foo (a) values('a cb');
insert into foo (a) values('ac b');
insert into foo (a) values('a c b');
insert into foo (a) values('ábç');
insert into foo (a) values('áb ç');
insert into foo (a) values('á b ç');
insert into foo (a) values('áçb');
insert into foo (a) values('á çb');
insert into foo (a) values('á ç b');
insert into foo (a) values(' abc');
insert into foo (a) values('ABC');
insert into foo (a) values('A B C');
insert into foo (a) values('A CB');
insert into foo (a) values('Á ÇB');
commit;

update foo set b = a;
update foo set c = a;
commit;

select * from foo order by a;
A B C
=========== =========== ===========
abc abc abc
A B C A B C A B C
a b c a b c a b c
á b ç á b ç á b ç
a bc a bc a bc
a c b a c b a c b
á ç b á ç b á ç b
A CB A CB A CB
Á ÇB Á ÇB Á ÇB
a cb a cb a cb
á çb á çb á çb
ab c ab c ab c
áb ç áb ç áb ç
ABC ABC ABC
abc abc abc
ábç ábç ábç
ac b ac b ac b
acb acb acb
áçb áçb áçb

select * from foo order by b;
A B C
=========== =========== ===========
abc abc abc
abc abc abc
a bc a bc a bc
a b c a b c a b c
ab c ab c ab c
ABC ABC ABC
A B C A B C A B C
ábç ábç ábç
á b ç á b ç á b ç
áb ç áb ç áb ç
acb acb acb
a cb a cb a cb
a c b a c b a c b
ac b ac b ac b
A CB A CB A CB
áçb áçb áçb
á çb á çb á çb
á ç b á ç b á ç b
Á ÇB Á ÇB Á ÇB

select * form foo order by c;
A B C
=========== =========== ===========
abc abc abc
A B C A B C A B C
a b c a b c a b c
á b ç á b ç á b ç
a bc a bc a bc
a c b a c b a c b
á ç b á ç b á ç b
A CB A CB A CB
Á ÇB Á ÇB Á ÇB
a cb a cb a cb
á çb á çb á çb
ab c ab c ab c
áb ç áb ç áb ç
ABC ABC ABC
abc abc abc
ábç ábç ábç
ac b ac b ac b
acb acb acb
áçb áçb áçb

Note that column A and C that uses collation PT_BR treat spaces as a
relevant char, column B that uses collatoin PT_PT ignore spaces.


see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br