FirebirdSQL / firebird

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

DPB flag isc_dpb_utf8_filename don't work [CORE3172] #3546

Open firebird-automations opened 14 years ago

firebird-automations commented 14 years ago

Submitted by: Pierre Yager (pierrey)

Duplicates CORE2172

Attachments: CORE-3127.cpp.7z

While trying to implement support to utf8_filename DPB flag into UIB Components we cannot pass any test.

1) I created a database with a system charset filename in either server, then I renamed it to unicode charset using the operating system commands (Rename on Windows, mv on Linux). For instance I choosed this name : привет.fdb

2) I succeded accessing the database on the Linux server using ISQL on both Linux and Windows clients. On Windows client the database name has to be specified in an input file, on Linux client, the filename can be specified either as a command line argument or in an input file but neither allow to specify the connexion string within the ISQL console prompt.

3) On Windows clients, accessing such databases is impossible. I gave a look at the Firebird engine core and It seems that the algorithm to resolve file names is : read filename; if not isc_dpb_utf8filename then ISC_SystemToUTF8(filename); ISC_UTF8ToSystem(filename); Open(filename)

So the filename is always accessed using an ANSI filename throught ANSI API on Windows. On Linux SystemToUTF8/UTF8ToSystem functions are void and fopen((char*)) is UTF8 compliant.

4) Within the Delphi (2010, Full Unicode) client using the latest UIB Components I tried different compositions between adding the utf8_filename flag or not, transcoding the database name to utf8 or not...

Results :

* utf8_filename flag : ON - Filename : UTF8 : I get this error : Cannot transliterate character between character sets / Connection error / Error Code: 652 * utf8_filename flag : OFF - Filename : UTF8 : I get this error : I/O error during "open" operation for file "/db/├É┬┐├æÔé¼├É┬©├É┬▓├É┬Á├æÔÇÜ.fdb" Error while trying to open file No such file or directory Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements Error Code: 24

* utf8_filename flag : ON - Filename : Ansi : the filename is sent as ?????.fdb because there is no russian chars in the Win1252 charset * utf8_filename flag : OFF - Filename : Ansi : same as above.

firebird-automations commented 14 years ago

Commented by: @asfernandes

It's supposed to work only if the unicode characters are included in the system ANSI codepage.

There is another ticket opened about full support for Unicode.

firebird-automations commented 14 years ago

Commented by: @asfernandes

Duplicates CORE2172.

firebird-automations commented 14 years ago
Modified by: @asfernandes status: Open \[ 1 \] =\> Resolved \[ 5 \] resolution: Duplicate \[ 3 \]
firebird-automations commented 14 years ago
Modified by: @asfernandes Link: This issue duplicates [CORE2172](https://github.com/FirebirdSQL/firebird/issues?q=CORE2172+in%3Atitle) \[ [CORE2172](https://github.com/FirebirdSQL/firebird/issues?q=CORE2172+in%3Atitle) \]
firebird-automations commented 14 years ago
Modified by: @pcisar status: Resolved \[ 5 \] =\> Closed \[ 6 \]
firebird-automations commented 8 years ago

Commented by: @aafemt

This ticket is not a duplicate because is caused not by lack of Unicode support in engine, but unnesessary recoding of UTF-8 file names into ANSI code page in Y-valve on client side, which completely beats the idea behind isc_dpb_utf8_filename flag.

firebird-automations commented 8 years ago
Modified by: @aafemt status: Closed \[ 6 \] =\> Reopened \[ 4 \] Planning Status: Considered for inclusion resolution: Duplicate \[ 3 \] =\>
firebird-automations commented 8 years ago

Commented by: @aafemt

Testcase for this ticket and (most likely) CORE2172 as well.

firebird-automations commented 8 years ago
Modified by: @aafemt Attachment: [CORE3127](https://github.com/FirebirdSQL/firebird/issues?q=CORE3127+in%3Atitle)\.cpp\.7z \[ 12919 \]
mikekaganski commented 3 years ago

It looks like the problem is reasonably straightforward to handle by settling on URF-8 on Windows, so that all that ping-pong with ISC_utf8ToSystem -> ISC_systemToUtf8 in Dispatcher::attachOrCreateDatabase would be a no-op, and finally, in src/common/os/win32/os_utils.cpp, the relevant functions would internally convert the UTF-8-encoded octet strings into wchar_t*, and use Windows-specific "wide" API like _wfopen?

aafemt commented 3 years ago

It is faaaar from that simple as shown unicode branch.