lib/net/ber.rb in net-ldap-0.3.1 vs lib/net/ber.rb in net-ldap-0.5.1
- old
+ new
@@ -1,6 +1,8 @@
# -*- ruby encoding: utf-8 -*-
+require 'net/ldap/version'
+
module Net # :nodoc:
##
# == Basic Encoding Rules (BER) Support Module
#
# Much of the text below is cribbed from Wikipedia:
@@ -104,11 +106,11 @@
# <tr><th>CHARACTER STRING</th><th>C</th><td>29: 61 (0x3d, 0b00111101)</td></tr>
# <tr><th>BMPString</th><th>P</th><td>30: 30 (0x1e, 0b00011110)</td></tr>
# <tr><th>BMPString</th><th>C</th><td>30: 62 (0x3e, 0b00111110)</td></tr>
# </table>
module BER
- VERSION = '0.3.1'
+ VERSION = Net::LDAP::VERSION
##
# Used for BER-encoding the length and content bytes of a Fixnum integer
# values.
MAX_FIXNUM_SIZE = 0.size
@@ -294,10 +296,10 @@
class Net::BER::BerIdentifiedString < String
attr_accessor :ber_identifier
def initialize args
super args
# LDAP uses UTF-8 encoded strings
- force_encoding('UTF-8') if respond_to?(:encoding)
+ self.encode('UTF-8') if self.respond_to?(:encoding) rescue self
end
end
module Net::BER
##