Index: Gemfile
===================================================================
--- Gemfile	(revision 10206)
+++ Gemfile	(working copy)
@@ -6,6 +6,7 @@
 gem "coderay", "~> 1.0.6"
 gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
 gem "builder"
+gem "stringex"
 
 # Optional gem for LDAP authentication
 group :ldap do
Index: test/unit/helpers/application_helper_test.rb
===================================================================
--- test/unit/helpers/application_helper_test.rb	(revision 10206)
+++ test/unit/helpers/application_helper_test.rb	(working copy)
@@ -529,7 +529,7 @@
       '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
       '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>',
       # UTF8 anchor
-      '[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page##{CGI.escape 'Тест'}" class="wiki-page">Тест</a>|,
+      '[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page#Tiest" class="wiki-page">Тест</a>|,
       # page that doesn't exist
       '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
       '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb	(revision 10206)
+++ app/helpers/application_helper.rb	(working copy)
@@ -1157,12 +1157,7 @@
   end
 
   def sanitize_anchor_name(anchor)
-    if ''.respond_to?(:encoding)
-      anchor.gsub(%r{[^\p{Word}\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
-    else
-      # TODO: remove when ruby1.8 is no longer supported
-      anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
-    end
+    anchor.to_ascii.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
   end
 
   # Returns the javascript tags that are included in the html layout head
