14.08.2020 13:56, Mark Rotteveel wrote:
b) Otherwise, there shall be no <separator> between the <introducer> and the <character set specification>, and the set of characters contained in the <character string literal> shall be wholly contained in the character set specified by the <character set specification>.
a) If the <character string literal> specifies a <character set specification>, then the character set specified by that <character set specification>.
As I read it, "character string literal" is referring to the result of whole construction "introducer + character representation" and thus describe the final form of the string.
At the same time <character representation> is described as <character representation> ::= <nonquote character> | <quote symbol> <nonquote character> ::= !! See the Syntax Rules. What are syntax rules for "nonquote character"?
As I read, the current behaviour of Firebird is correct, it is just damn awkward to achieve.
Taking into account uncertainty of the standard text cast-like usage also may fit. In (most widespread AFAIU) cases like "_win1251 0x'e0e1e2'" there is actually no difference between them because the final result is a string in character set OCTETS being casted to WIN1251. The difference can only been seen with "_win1251 'абв'" which result is barely predicable.
As an application developer I would prefer <character representation> to be always treated as having connection character set.
-- WBR, SD. Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel