Skip to content

Commit 23a45fc

Browse files
committed
Modification method change for incompatible character encodings error #40
1 parent 60bb367 commit 23a45fc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name 'View Customize plugin'
44
author 'onozaty'
55
description 'View Customize plugin for Redmine'
6-
version '2.3.0.40-1'
6+
version '2.3.0.40-2'
77
url 'https://github.com/onozaty/redmine-view-customize'
88
author_url 'https://github.com/onozaty'
99

lib/view_customize/view_hook.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module RedmineViewCustomize
22
class ViewHook < Redmine::Hook::ViewListener
33
def view_layouts_base_html_head(context={})
44

5-
path = context[:request].path_info.force_encoding('UTF-8');
5+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
66

77
html = "\n<!-- [view customize plugin] path:#{path} -->\n"
88
html << stylesheet_link_tag("view_customize", plugin: "view_customize")
@@ -17,7 +17,8 @@ def view_layouts_base_html_head(context={})
1717

1818
def view_issues_form_details_bottom(context={})
1919

20-
return create_view_customize_html(context[:request].path_info.force_encoding('UTF-8'), ViewCustomize::INSERTION_POSITION_ISSUE_FORM)
20+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
21+
return create_view_customize_html(path, ViewCustomize::INSERTION_POSITION_ISSUE_FORM)
2122
end
2223

2324
def view_issues_show_details_bottom(context={})
@@ -26,7 +27,8 @@ def view_issues_show_details_bottom(context={})
2627
html << "ViewCustomize.context.issue = { id: #{context[:issue].id} };"
2728
html << "\n//]]>\n</script>"
2829

29-
html << create_view_customize_html(context[:request].path_info.force_encoding('UTF-8'), ViewCustomize::INSERTION_POSITION_ISSUE_SHOW)
30+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
31+
html << create_view_customize_html(path, ViewCustomize::INSERTION_POSITION_ISSUE_SHOW)
3032

3133
return html
3234
end

0 commit comments

Comments
 (0)