ports/net/rubygem-net-ldap/files/patch-ruby19
Steve Wills 53220b9083 - Add patch to work correctly with ruby19
PR:		ports/177883
Submitted by:	Rainer Duffner <rainer@ultra-secure.de>
Obtained from:	https://github.com/ruby-ldap/ruby-net-ldap/pull/41/files (upstream)
2013-05-27 18:53:17 +00:00

15 lines
500 B
Text

--- 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