diff options
-rw-r--r-- | app/controllers/public_body_controller.rb | 4 | ||||
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 02f0ceb19..1f7032eed 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -113,8 +113,8 @@ class PublicBodyController < ApplicationController elsif @tag == 'other' category_list = PublicBodyCategories::get().tags().map{|c| "'"+c+"'"}.join(",") where_condition += base_tag_condition + " AND has_tag_string_tags.name in (#{category_list})) = 0" - elsif @tag.size == 1 - @tag.upcase! + elsif @tag.scan(/./mu).size == 1 + @tag = Unicode.upcase @tag # The first letter queries have to be done on # translations, so just indicate to add that later: first_letter = true diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 2d1b1466f..025ebfdba 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -250,6 +250,13 @@ describe PublicBodyController, "when listing bodies" do response.code.should == '406' end + it "should list authorities starting with a multibyte first letter" do + get :list, {:tag => "å", :show_locale => 'cs'} + response.should render_template('list') + assigns[:public_bodies].should == [ public_bodies(:accented_public_body) ] + assigns[:tag].should == "Å" + end + end describe PublicBodyController, "when showing JSON version for API" do |