[sqlite] Unicode command line bug in Windows version of sqlite3 with patch
Hello SQLite Team, We currently use sqlite 3.6.23. We have a big problem with characters with accents or other special characters in path to database file, for example in Czech Windows XP the Application Data folder is translated to Data aplikací so if the accented 'í' is in path the sqlite3.exe writes that it is unable to open file in this path. To workaround this problem we tried to find the source of this error. It lies in MultiByteToWideChar and WideCharToMultiByte with CP_UTF8 as encoding argument. If is instead used CP_ACP as ANSI encoding then there is no problem. In attachment you will find diff patch which works for us. But because SQLite3 source code is really big we can't be sure that this fix is correct and doesn't introduce any side effects. Thanks for your hard work and help Filip Kunc ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Unicode command line bug in Windows version of sqlite3 with patch
sqlite3_open[_v2] accepts all filenames in UTF-8 (although it doesn't check for valid UTF-8 string). So CP_UTF8 cannot be changed anywhere. OTOH maybe command line utility should have some logic of re-encoding of command line parameter from terminal encoding to UTF-8. But I'm not sure about that. Could you try to run sqlite3 from a batch file that is written in UTF-8 encoding (properly encode your path). I believe it will work this way... Pavel 2010/3/16 Kunc Filip k...@medictech.com: Hello SQLite Team, We currently use sqlite 3.6.23. We have a big problem with characters with accents or other special characters in path to database file, for example in Czech Windows XP the Application Data folder is translated to Data aplikací so if the accented 'í' is in path the sqlite3.exe writes that it is unable to open file in this path. To workaround this problem we tried to find the source of this error. It lies in MultiByteToWideChar and WideCharToMultiByte with CP_UTF8 as encoding argument. If is instead used CP_ACP as ANSI encoding then there is no problem. In attachment you will find diff patch which works for us. But because SQLite3 source code is really big we can't be sure that this fix is correct and doesn't introduce any side effects. Thanks for your hard work and help Filip Kunc ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Unicode command line bug in Windows version of sqlite3 with patch
We currently use sqlite 3.6.23. We have a big problem with characters with accents or other special characters in path to database file, for example in Czech Windows XP the Application Data folder is translated to Data aplikací so if the accented 'í' is in path the sqlite3.exe writes that it is unable to open file in this path. A much better solution is to use a MSYS terminal (installed by MinGW), so you have UTF-8 command-line and data entry/display without conversion. No need to patch anything. The culprit here isn't the command-line utility, but the WinDOS usage of old charset. In attachment you will find diff patch which works for us. But because SQLite3 source code is really big we can't be sure that this fix is correct and doesn't introduce any side effects. If you change input encoding and use your code page, then it's likely you'll going to do the same with data, which is plain wrong: SQLite needs UTF-8 (or UTF-16) data, not ANSI. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Unicode command line bug in Windows version of sqlite3 with patch
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jean-Christophe Deschamps wrote: A much better solution is to use a MSYS terminal (installed by MinGW), so you have UTF-8 command-line and data entry/display without conversion. No need to patch anything. No need for msys. You can make a regular command prompt use UTF8 by switching to code page 65001. Either of these commands will do that. chcp 65001 mode con cp select=65001 You can use chcp or mode con to see the current code page. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkuf/5UACgkQmOOfHg372QS+xACg0VZPfwEz4y2OAzs4OpHon+EG crIAoMsd8wVrRWhhPBouPVnI1m0M4lL/ =/eXW -END PGP SIGNATURE- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users