Subject Re: [firebird-support] Re: Euro characters and UPPER
Author Helen Borrie
At 12:17 PM 24/11/2005 +0000, you wrote:
>I tried the _iso8859_1 in front of the string, but the øæå was just a
>simple example. I need to have a field there that will be converted
>to uppercase.
>
>But this is the important question: If I create a database with say
>ISO8859_1, then will UPPER work with Euro characters?

Yes. But the mappings will not be right for Norwegian unless you specify
the NO_NO collation. The lower-to-upper case mappings vary from one locale
set to another.

You can't (currently) specify a default collation for a database. The
default collation in all cases is the binary one (that whose name matches
the name of the charset). That mapping simply "reduces" the lowercase
character to an unaccented character and returns the uppercase of that
character.

You can apply a collation to an index, an argument or an expression field.

A collation can only be applied to the character set it belongs to. So,
for example, you can't apply COLLATE NO_NO to a column that is stored as
character set NONE or charset UNICODE_FSS, or indeed any charset except
ISO8859_1.

The introducer syntax shown by Pavel is a way to "cast" charset NONE data
to the one you want, but it only works with literal strings, not with
column references or replaceable parameters. You can recast charset NONE
data by casting it as a char(n) or varchar(n) of the same type and size as
your stored data, e.g.

update MyTable
set MyUpperedColumn = upper(cast (MyNoneColumnv40 as varchar(40) character
set ISO8859_1 COLLATE NO_NO))

Of course, this is only half the job if MyUpperedColumn is not defined as
character set ISO8859_1. The engine still has no way to know that the data
stored there contains upper case characters from the ISO8859_1 character
set *or* that the uppercasing follows the mappings defined in collation
NO_NO. You won't be able to define an index according to collate NO_NO, so
orderings and searches will be just according to the ordinality of the
character codes.

./heLen