Fixed: Title with non-ascii characters breaks wiki

git-svn-id: http://redmine.rubyforge.org/svn/trunk@805 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-10-05 19:33:25 +00:00
parent e8971e5f83
commit 69c2965051
2 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,7 @@ class Wiki < ActiveRecord::Base
# replace spaces with _ and remove unwanted caracters
title = title.gsub(/\s+/, '_').delete(',./?;|:') if title
# upcase the first letter
title = (title.length > 1 ? title.first.upcase + title[1..-1] : title.upcase) if title
title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
title
end
end

View File

@ -36,4 +36,9 @@ class WikiTest < Test::Unit::TestCase
@wiki.reload
assert_equal "Another start page", @wiki.start_page
end
def test_titleize
assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES')
assert_equal 'テスト', Wiki.titleize('テスト')
end
end