From df6cd07e1ae960c0827d2d1e2e17ba6df71f38b6 Mon Sep 17 00:00:00 2001 From: Peter Marschall Date: Sat, 8 Dec 2012 20:37:54 +0100 Subject: [PATCH] RT#73202: LDIF.pm: Base64-encode values ending in spaces Although not required by the RFC, Base64-encode those values that end in spaces when writing LDIFs. This makes it easier for the user to visually detect those values and increases compatibility with other implementations (e.g. OpenLDAP's ldapsearch). --- lib/Net/LDAP/LDIF.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Net/LDAP/LDIF.pm b/lib/Net/LDAP/LDIF.pm index 1b7d2a7..83b6b3b 100644 --- a/lib/Net/LDAP/LDIF.pm +++ b/lib/Net/LDAP/LDIF.pm @@ -401,7 +401,7 @@ sub _write_attr { $v = Encode::encode_utf8($v) if (CHECK_UTF8 and Encode::is_utf8($v)); - if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff])/) { + if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff]| $)/) { require MIME::Base64; $ln .= ':: ' . MIME::Base64::encode($v, ''); }