On 30.08.2026 at 17:02, 'Dimitry Sibiryakov' via firebird-support wrote:
> Tomasz Tyrakowski wrote 30.08.2026 16:29:
>> How should I properly convert the buffer returned by
>> IUtil::formatStatus() to a Unicode string, assuming my declared client
>> character set is UTF-8?
>
> Short answer: you cannot.
That's what I've figured so far - not without some help from the server.
> Long answer: OS error is transferred as an error number, not string
> and converted to string on client side.
I don't believe it is so. I've just connected from a Linux isql to a FB
server running on Windows and I'm pretty sure the message Linux isql
shows me is the Windows error message (in Polish), while using the same
isql on the same Linux machine to connect to a Linux server shows an
English message ("No such file or directory").
Besides, it would seem unlikely that a client running on Linux (MacOS,
Android, ...) would know how to translate a Win32 error code into an
error message (it applies to any combination of different server/client
OS's). It can't rely on its own OS to do that, because it's a different OS.
So I guess the _Firebird_ error is transferred as ISC code and converted
to a message client-side, but the included OS error message is sent as a
string. I'm not sure (would have to hunt it down in the Firebird
sources), but all evidence so far supports it.
> Windows use ANSI function for
> that so the result is always in ANSI code page regardless of connection
> charset. But the rest of strings are in connection charset. The problem
> is that IUtil::formatStatus() convert whole status vector at once so you
> even cannot separate these string.
> In fact, the only solution for that is a manual handling of status.
That can be handled properly only server-side IMHO. The server knows the
OS it's running on and its locale, while the client does not have that
knowledge, so it can't guess which ANSI encoding the server uses in OS
messages (even if the client decided to decode the status by hand, it
won't be able to without this knowledge).
The problem surfaced when one of my users encountered an error with "No
such file or directory", but while connecting to a server running on
Windows with Russian locale, so the included OS error was "Не удается
найти указанный файл", encoded (probably) as CP-1251. Trying to decode
the error message from UTF-8 resulted in invalid UTF-8 sequences.
Anyway, thank you for the information you provided, I'll think about
some workarounds, because it seems it's unsolvable client-side at the
moment.
regards
Tomasz