Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8):
Created by: huacnlee
Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8):
lib/banzai/filter/reference_filter.rb:169:in `block in replace_link_nodes_with_href'
lib/banzai/filter/reference_filter.rb:161:in `replace_link_nodes_with_href'
lib/banzai/filter/user_reference_filter.rb:56:in `call'
lib/banzai/pipeline/base_pipeline.rb:24:in `block (2 levels) in singleton class'
lib/banzai/renderer.rb:33:in `render_result'
lib/banzai/renderer.rb:63:in `cacheless_render'
lib/banzai/renderer.rb:28:in `render'
lib/banzai.rb:3:in `render'
app/helpers/gitlab_markdown_helper.rb:53:in `markdown'
app/helpers/application_helper.rb:223:in `render_markup'
app/helpers/tree_helper.rb:28:in `render_readme'
app/views/projects/_readme.html.haml:8:in `block in _app_views_projects__readme_html_haml__24078851049771230_69895952334220'
app/views/projects/_readme.html.haml:7:in `_app_views_projects__readme_html_haml__24078851049771230_69895952334220'
app/views/projects/show.html.haml:71:in `_app_views_projects_show_html_haml___2846687072891198413_69896035096560'
app/controllers/projects_controller.rb:106:in `block (2 levels) in show'
app/controllers/projects_controller.rb:96:in `show'
Branch: 8-3-stable Bad content:
http://demo.somehost.com/system/ids_extracted/ef/1e/03/55/4e8e228c344ff3430b83ec01/%E4%BA%B2%E5%AF%86%E4%BB%9814-4-30/index.html#p=修改
irb(main):006:0> URI.decode('http://demo.somehost.com/system/ids_extracted/ef/1e/03/55/4e8e228c344ff3430b83ec01/%E4%BA%B2%E5%AF%86%E4%BB%9814-4-30/index.html#p=修改')
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8
There have an unescaped chars in URL, but that is user generate content, we can't control it.
If use CGI.unescape
, it can work:
irb(main):012:0> CGI.unescape('http://demo.somehost.com/system/ids_extracted/ef/1e/03/55/4e8e228c344ff3430b83ec01/%E4%BA%B2%E5%AF%86%E4%BB%9814-4-30/index.html#p=修改')
=> "http://demo.somehost.com/system/ids_extracted/ef/1e/03/55/4e8e228c344ff3430b83ec01/亲密付14-4-30/index.html#p=修改"