ceb09b
--- a/modules/aaa/mod_authnz_ldap.c	2018/02/15 17:33:04	1824335
ceb09b
+++ b/modules/aaa/mod_authnz_ldap.c	2018/02/15 17:42:14	1824336
ceb09b
@@ -126,9 +126,13 @@
ceb09b
 
ceb09b
     charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING);
ceb09b
 
ceb09b
-    if (!charset) {
ceb09b
-        language[2] = '\0';
ceb09b
-        charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING);
ceb09b
+    /*
ceb09b
+     * Test if language values like 'en-US' return a match from the charset
ceb09b
+     * conversion map when shortened to 'en'.
ceb09b
+     */
ceb09b
+    if (!charset && strlen(language) > 3 && language[2] == '-') {
ceb09b
+        char *language_short = apr_pstrndup(p, language, 2);
ceb09b
+        charset = (char*) apr_hash_get(charset_conversions, language_short, APR_HASH_KEY_STRING);
ceb09b
     }
ceb09b
 
ceb09b
     if (charset) {