diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index f77c5e26..89d173b1 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -755,7 +755,7 @@ def parse_filter_branch(scanner) scanner.scan(/\s*/) if op = scanner.scan(/<=|>=|!=|:=|=/) scanner.scan(/\s*/) - if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!'\s\xC3\x80-\xCA\xAF]|\\[a-fA-F\d]{2})+/) + if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!'\s\xC3\x80-\xCA\xAF]|[^\x00-\x7F]|\\[a-fA-F\d]{2})+/u) # 20100313 AZ: Assumes that "(uid=george*)" is the same as # "(uid=george* )". The standard doesn't specify, but I can find # no examples that suggest otherwise. diff --git a/spec/unit/ldap/filter_parser_spec.rb b/spec/unit/ldap/filter_parser_spec.rb new file mode 100644 index 00000000..e34828eb --- /dev/null +++ b/spec/unit/ldap/filter_parser_spec.rb @@ -0,0 +1,20 @@ +# encoding: utf-8 +require 'spec_helper' + +describe Net::LDAP::Filter::FilterParser do + + describe "#parse" do + context "Given ASCIIs as filter string" do + let(:filter_string) { "(cn=name)" } + specify "should generate filter object" do + expect(Net::LDAP::Filter::FilterParser.parse(filter_string)).to be_a Net::LDAP::Filter + end + end + context "Given string including multibyte chars as filter string" do + let(:filter_string) { "(cn=名前)" } + specify "should generate filter object" do + expect(Net::LDAP::Filter::FilterParser.parse(filter_string)).to be_a Net::LDAP::Filter + end + end + end +end