diff --git a/multibyte.c b/multibyte.c
index e97e0b0..5c9a13c 100644
--- a/multibyte.c
+++ b/multibyte.c
@@ -494,7 +494,7 @@ derive_locale_encoding(const char *dbencoding)
 	/*
 	 *	Derive the encoding from the codeset part of the current locale.
 	 */
-	loc = setlocale(LC_ALL, "");
+	loc = setlocale(LC_CTYPE, "");
 	if (loc && (ptr = strchr(loc, '.')))
 	{
 		int enc_no;
