FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

5.0.0.0-RC1 Native Error Exception 335545170 Macos SONOMA 14.1 #7822

Closed greyns closed 11 months ago

greyns commented 1 year ago

Error opening international conversion descriptor from to UTF-8 Invalid argument

Only with Macos 14.1 Sonoma, works fine with previous release Don't know if it is coming from Firedac/Delphi or from Firebird

AlexPeshkoff commented 1 year ago

What version of FB are you using?

greyns commented 1 year ago

FB 5.0.0.1227-RC1 I tried the last snapshot build (1254) and it is the same

greyns commented 1 year ago

Answer from Embarcadero :

Re: Error FireDac + MacOS 14.1 Sonoma + Firebird 5 RC1

Sync status from internal system, internal issue closed on Nov 10, 2023 by Dmitry Arefiev with comment: The issue must be fixed on Firebird side.

dyemanov commented 1 year ago

@AlexPeshkoff The docs says that "" (empty string) can be passed (instead of "char") to iconv_open to represent the current system locale. But we pass NULL instead (const char* const IConv::SYSTEM = NULL). Could it be the reason?

hvlad commented 1 year ago

The SYSTEM itself is not passed into iconv_open(), empty string could be returned by charmapName(SYSTEM)

AlexPeshkoff commented 12 months ago

If empty string can be used as system encoding charmapName() becomes pretty useless. But... @dyemanov Linux'es man iconv_open says nothing about use of empty string for system encoding. Can you proof-link that? PPS. I think that should be some very serious link - in man I can read that 'The values permitted for fromcode and tocode and the supported combinations are system-dependent'. I.e. I'm afraid that some libc can reject to support empty string here.

aafemt commented 12 months ago

http://git.savannah.gnu.org/cgit/libiconv.git/tree/lib/iconv_open1.h#n89 It works only if setlocale() was called.

AlexPeshkoff commented 12 months ago

The feature is documented for oracle linux & mac os. https://docs.oracle.com/cd/E86824_01/html/E54766/iconv-open-3c.html https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/iconv_open.3.html

If changing const char const IConv::SYSTEM = NULL; to const char const IConv::SYSTEM = ""; helps - I see no problems with such a fix.

But first of all I suggest to@greyns to try from command line: echo QQ|iconv -f UTF8 -t cp1251 echo QQ|iconv -f UTF8 -t UTF8 and see what happens.

greyns commented 12 months ago

I've tried and it seems to do...nothing : echo QQ|iconv -f UTF8 -t cp1251 QQ echo QQ|iconv -f UTF8 -t UTF8 QQ

I can test what you want. I have a Macbook with MacOS13.6.1 and a Mac Mini with MacOS 14.1.1 My softwares are installed on both the same way, with the same releases of Firebird. On MacOS 13.6.1 : no problem On MacOS 14.1.1 : Exception message = [FireDAC][Phys][FB]Error opening international conversion descriptor from to UTF-8 Invalid argument

Le jeu. 23 nov. 2023 à 10:34, Alexander Peshkov @.***> a écrit :

The feature is documented for oracle linux & mac os. https://docs.oracle.com/cd/E86824_01/html/E54766/iconv-open-3c.html

https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/iconv_open.3.html

If changing const char const IConv::SYSTEM = NULL; to const char const IConv::SYSTEM = ""; helps - I see no problems with such a fix.

But first of all I suggest @.*** to try from command line: echo QQ|iconv -f UTF8 -t cp1251 echo QQ|iconv -f UTF8 -t UTF8 and see what happens.

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1824067453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HJHKQLPBFXUWQ6424TYF4KCHAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGA3DONBVGM . You are receiving this because you authored the thread.Message ID: @.***>

AlexPeshkoff commented 12 months ago

I did not expect that commands to change input text - just wanted to make sure they do not fail.

Please also try: echo QQ|iconv -f UTF8 -t UTF-8 (I see exactly this in your error message).

Next - did you try to attach to same datasource as one used in Firedac/Delphi using our isql?

greyns commented 12 months ago

echo QQ|iconv -f UTF8 -t UTF-8 QQ

I'm not used with ISQ (nor command line, coming from Windows ! Sorry). What do you want me to try ?

Le jeu. 23 nov. 2023 à 11:24, Alexander Peshkov @.***> a écrit :

I did not expect that commands to change input text - just wanted to make sure they do not fail.

Please also try: echo QQ|iconv -f UTF8 -t UTF-8 (I see exactly this in your error message).

Next - did you try to attach to same datasource as one used in Firedac/Delphi using our isql?

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1824136883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HNTLPRJR4EOOBKBMLLYF4P43AVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGEZTMOBYGM . You are receiving this because you authored the thread.Message ID: @.***>

AlexPeshkoff commented 12 months ago

isql -user NAME -pas PASSWORD HOST:DBPATH subst words in CAPITAL with your actual values

greyns commented 12 months ago

It works, no error...

Le jeu. 23 nov. 2023, 11:31, Alexander Peshkov @.***> a écrit :

isql -user NAME -pas PASSWORD HOST:DBPATH subst words in CAPITAL with your actual values

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1824154130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HPIDATX7HXSXVMY5P3YF4QZLAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGE2TIMJTGA . You are receiving this because you authored the thread.Message ID: @.***>

aafemt commented 12 months ago

Try to call setlocale() at the start of your application.

greyns commented 12 months ago

I'm going to try... Actually I have that on both Mac : LANG="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_CTYPE="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_ALL=

Le jeu. 23 nov. 2023 à 11:47, Dimitry Sibiryakov @.***> a écrit :

Try to call setlocale() at the start of your application.

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1824200274, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HJHYJ35OUGSVM6UEH3YF4SVPAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGIYDAMRXGQ . You are receiving this because you authored the thread.Message ID: @.***>

aafemt commented 12 months ago

You must be aware that on *NIX-based systems these locale settings are not applied to processes automatically but requires an explicit call of setlocale().

greyns commented 12 months ago

I'm trying to execute from my app : _system(PAnsiChar('setlocale(LC_ALL, "fr_FR.UTF-8")') but it is not working because LC_ALL is not recognized by the system.

So I tried : {$IFDEF MACOS} _system(PAnsiChar('export LC_ALL="fr_FR.UTF-8"')); {$ENDIF MACOS} It works but I still can't connect to database.

Le jeu. 23 nov. 2023 à 13:10, Dimitry Sibiryakov @.***> a écrit :

You must be aware that on *NIX-based systems these locale settings are not applied to processes automatically but requires an explicit call of setlocale().

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1824324669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HKEZPEJDRSEYOYZV7LYF44KJAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGMZDINRWHE . You are receiving this because you authored the thread.Message ID: @.***>

aafemt commented 12 months ago

setlocale() is function, not utility. It must be called directly: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Setlocale,_wsetlocale

greyns commented 12 months ago

I saw that, this valid from C++, not from Delphi/Pascal

Le ven. 24 nov. 2023 à 12:02, Dimitry Sibiryakov @.***> a écrit :

setlocale() is function, not utility. It must be called directly: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Setlocale,_wsetlocale

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1825505935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HLQRPJBOCBIYKK2KA3YGB5CVAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGUYDKOJTGU . You are receiving this because you authored the thread.Message ID: @.***>

aafemt commented 12 months ago

Delphi can call C functions without problems. Perhaps setlocale() is declared in Posix.Locale unit?..

greyns commented 12 months ago

Congratulations guys ! Now it works...

I have added in uses clause : {$IFDEF MACOS} , Posix.Stdlib, Posix.Locale {$ENDIF MACOS}

and in the OnCreate of main form : {$IFDEF MACOS} setlocale(LC_ALL, PAnsiChar('fr_FR.UTF-8')); {$ENDIF MACOS}

Your support is more efficient than Embarcadero's one... Don't know if it is on Apple or Embarcadero's side that the problem appears but it is solved with your help. Thanks.

Le ven. 24 nov. 2023 à 12:14, Dimitry Sibiryakov @.***> a écrit :

Delphi can call C functions without problems. Perhaps setlocale() is declared in Posix.Locale unit?..

— Reply to this email directly, view it on GitHub https://github.com/FirebirdSQL/firebird/issues/7822#issuecomment-1825520723, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIH7HPRM4KA6L3LZPFKPVDYGB6RTAVCNFSM6AAAAAA62WQ7VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGUZDANZSGM . You are receiving this because you authored the thread.Message ID: @.***>