summaryrefslogtreecommitdiff
path: root/net/rubygem-net-ldap/files/patch-ruby19
blob: 6f7a6e25fb59c412293e700ebee0e89a65472d47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- lib/net/ber/core_ext/string.rb
+++ lib/net/ber/core_ext/string.rb
@@ -20,7 +20,11 @@ def raw_utf8_encoded
     if self.respond_to?(:encode)
       # Strings should be UTF-8 encoded according to LDAP.
       # However, the BER code is not necessarily valid UTF-8
-      self.encode('UTF-8').force_encoding('ASCII-8BIT')
+      begin
+        self.encode('UTF-8').force_encoding('ASCII-8BIT')
+      rescue Encoding::UndefinedConversionError
+        self
+      end
     else
       self
     end