[Box Backup-commit] COMMIT r1860 - box/trunk/bin/bbackupquery

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 23 Sep 2007 19:54:08 +0100


Author: chris
Date: 2007-09-23 19:54:08 +0100 (Sun, 23 Sep 2007)
New Revision: 1860

Modified:
   box/trunk/bin/bbackupquery/bbackupquery.cpp
Log:
Set the locale from the environment, so that international characters
may be entered when using editline.


Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp
===================================================================
--- box/trunk/bin/bbackupquery/bbackupquery.cpp	2007-09-23 18:51:52 UTC (rev 1859)
+++ box/trunk/bin/bbackupquery/bbackupquery.cpp	2007-09-23 18:54:08 UTC (rev 1860)
@@ -303,7 +303,16 @@
 	}
 	
 	// Get commands from input
+
 #ifdef HAVE_LIBREADLINE
+	// Must initialise the locale before using editline's readline(),
+	// otherwise cannot enter international characters.
+	if (setlocale(LC_ALL, "") == NULL)
+	{
+		BOX_ERROR("Failed to initialise locale. International "
+			"character support may not work.");
+	}
+
 #ifdef HAVE_READLINE_HISTORY
 	using_history();
 #endif