Fancy quote interpreted as string literal

12 views
Skip to first unread message

Mark Rotteveel

unread,
Feb 13, 2026, 3:42:47 AM (10 days ago) Feb 13
to firebir...@googlegroups.com
Because of a wrong example in README.unlist, I discovered that - at
least in ISQL - a closing fancy single quote (’) is interpreted as a
normal single quote ('), and ISQL converts the ’ to ' before sending it
(or maybe already when reading it). It also converts the opening fancy
quote (‘) to a backtick (`)

Is this intentional behaviour or a bug?

For example, from ISQL, this works fine

select ’abc’ from RDB$DATABASE;

It doesn't work when sending such a string to Firebird with another tool
(e.g. DBeaver), so it's ISQL doing this.

The initial problematic example produced a continuation prompt as ISQL
handled it as if it was in the middle of a literal:

SQL> select U.C0 from unlist(‘text1, text2, text3’) as U(C0);
CON>

If you then close the literal and statement, it produces an error over
the opening fancy quote (‘), though converted to a backtick (`):

SQL> select U.C0 from unlist(‘text1, text2, text3’) as U(C0);
CON> ';
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 25
-`

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Feb 13, 2026, 4:06:36 AM (10 days ago) Feb 13
to firebir...@googlegroups.com
'Mark Rotteveel' via firebird-devel wrote 13.02.2026 9:42:
> Because of a wrong example in README.unlist, I discovered that - at least in
> ISQL - a closing fancy single quote (’) is interpreted as a normal single quote
> ('), and ISQL converts the ’ to ' before sending it (or maybe already when
> reading it). It also converts the opening fancy quote (‘) to a backtick (`)
>
> Is this intentional behaviour or a bug?

Yes, this is an intentional behavior of WideCharToMultiByte()
(https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte)
in absence of WC_NO_BEST_FIT_CHARS flag: it tries its best to find closer (by
appearance) character from your current code page.
Try `chcp 65001` and you may see a difference.

As I wrote earlier, handling of character sets in ISQL is a big mess.

--
WBR, SD.
Reply all
Reply to author
Forward
0 new messages