On Sat, Dec 12, 2009 at 12:39:23PM -0800, Roger Binns wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Alexey Pechnikov wrote: > > On unix the shell must do this initialisation: > > > > setlocale(LC_ALL, ""); > > Why? Yes I know what the call does, but what desirable effect does it have > on shell input and output? Pretty much all formatted output is done using > %s. The only float output is for timing commands. No input is done using > scanf. Except for the disabled by default iotrace, all fopens are in binary > mode.
If there's any perror()/strerror() calls, or if you're printing floats/doubles for user presentation then you definitely want to setlocale(). There are probably other reasons to call setlocale(). I see only strerror() calls in the proxy lock paths, so that's out. And SQLite3 doesn't distinguish between user presentation and other contexts. So not calling setlocale(LC_ALL, "") seems possibly appropriate, but it seems better to either not depend on it (so that if called by an the application, or an extension, nothing bad happens) or to force the use of the C locale (but a library must not do that!). Since an application using libsqlite3 can always call setlocale(), it seems to me that the sqlite3 shell should as well. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users