Project

General

Profile

Feature #26561 » frozen.patch

Pavel Rosický, 2019-03-06 20:19

View differences:

app/controllers/journals_controller.rb (working copy)
70 70
    end
71 71
    # Replaces pre blocks with [...]
72 72
    text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]')
73
    @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
73
    @content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
74 74
    @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
75 75
  rescue ActiveRecord::RecordNotFound
76 76
    render_404
app/controllers/messages_controller.rb (working copy)
115 115
    @subject = @message.subject
116 116
    @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
117 117

  
118
    @content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
118
    @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
119 119
    @content << @message.content.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
120 120
  end
121 121

  
app/controllers/search_controller.rb (working copy)
20 20
  accept_api_auth :index
21 21

  
22 22
  def index
23
    @question = params[:q] || ""
23
    @question = params[:q] || +""
24 24
    @question.strip!
25 25
    @all_words = params[:all_words] ? params[:all_words].present? : true
26 26
    @titles_only = params[:titles_only] ? params[:titles_only].present? : false
app/helpers/application_helper.rb (working copy)
278 278
  end
279 279

  
280 280
  def toggle_link(name, id, options={})
281
    onclick = "$('##{id}').toggle(); "
281
    onclick = +"$('##{id}').toggle(); "
282 282
    onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")
283 283
    onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll]
284 284
    onclick << "return false;"
......
322 322
  # The given collection may be a subset of the whole project tree
323 323
  # (eg. some intermediate nodes are private and can not be seen)
324 324
  def render_project_nested_lists(projects, &block)
325
    s = ''
325
    s = +''
326 326
    if projects.any?
327 327
      ancestors = []
328 328
      original_project = @project
......
352 352
  end
353 353

  
354 354
  def render_page_hierarchy(pages, node=nil, options={})
355
    content = ''
355
    content = +''
356 356
    if pages[node]
357 357
      content << "<ul class=\"pages-hierarchy\">\n"
358 358
      pages[node].each do |page|
......
369 369

  
370 370
  # Renders flash messages
371 371
  def render_flash_messages
372
    s = ''
372
    s = +''
373 373
    flash.each do |k,v|
374 374
      s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
375 375
    end
......
408 408

  
409 409
  def render_projects_for_jump_box(projects, selected=nil)
410 410
    jump = params[:jump].presence || current_menu_item
411
    s = ''.html_safe
411
    s = (+'').html_safe
412 412
    project_tree(projects) do |project, level|
413 413
      padding = level * 16
414 414
      text = content_tag('span', project.name, :style => "padding-left:#{padding}px;")
......
469 469
  end
470 470

  
471 471
  def principals_check_box_tags(name, principals)
472
    s = ''
472
    s = +''
473 473
    principals.each do |principal|
474 474
      s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
475 475
    end
......
478 478

  
479 479
  # Returns a string for users/groups option tags
480 480
  def principals_options_for_select(collection, selected=nil)
481
    s = ''
481
    s = +''
482 482
    if collection.include?(User.current)
483 483
      s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
484 484
    end
485
    groups = ''
485
    groups = +''
486 486
    collection.sort.each do |element|
487 487
      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected
488 488
      (element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
......
714 714
  def parse_non_pre_blocks(text, obj, macros)
715 715
    s = StringScanner.new(text)
716 716
    tags = []
717
    parsed = ''
717
    parsed = +''
718 718
    while !s.eos?
719 719
      s.scan(/(.*?)(<(\/)?(pre|code)(.*?)>|\z)/im)
720 720
      text, full_tag, closing, tag = s[1], s[2], s[3], s[4]
......
1194 1194
      if headings.empty?
1195 1195
        ''
1196 1196
      else
1197
        div_class = 'toc'
1197
        div_class = +'toc'
1198 1198
        div_class << ' right' if right_align
1199 1199
        div_class << ' left' if left_align
1200
        out = "<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
1200
        out = +"<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
1201 1201
        root = headings.map(&:first).min
1202 1202
        current = root
1203 1203
        started = false
......
1258 1258

  
1259 1259
  # Renders a list of error messages
1260 1260
  def render_error_messages(errors)
1261
    html = ""
1261
    html = +""
1262 1262
    if errors.present?
1263 1263
      html << "<div id='errorExplanation'><ul>\n"
1264 1264
      errors.each do |error|
app/helpers/calendars_helper.rb (working copy)
59 59
  end
60 60

  
61 61
  def calendar_day_css_classes(calendar, day)
62
    css = day.month==calendar.month ? 'even' : 'odd'
62
    css = day.month==calendar.month ? +'even' : +'odd'
63 63
    css << " today" if User.current.today == day
64 64
    css << " nwday" if non_working_week_days.include?(day.cwday)
65 65
    css
app/helpers/context_menus_helper.rb (working copy)
20 20
module ContextMenusHelper
21 21
  def context_menu_link(name, url, options={})
22 22
    options[:class] ||= ''
23
    options[:class] = options[:class].dup if options[:class].frozen?
23 24
    if options.delete(:selected)
24 25
      options[:class] << ' icon-checked disabled'
25 26
      options[:disabled] = true
app/helpers/custom_fields_helper.rb (working copy)
69 69

  
70 70
  def custom_field_tag_name(prefix, custom_field)
71 71
    name = "#{prefix}[custom_field_values][#{custom_field.id}]"
72
    name << "[]" if custom_field.multiple?
72
    name += "[]" if custom_field.multiple?
73 73
    name
74 74
  end
75 75

  
......
80 80
  # Return custom field html tag corresponding to its format
81 81
  def custom_field_tag(prefix, custom_value)
82 82
    css = "#{custom_value.custom_field.field_format}_cf"
83
    css << ' wiki-edit' if custom_value.custom_field.full_text_formatting?
83
    css += ' wiki-edit' if custom_value.custom_field.full_text_formatting?
84 84

  
85 85
    custom_value.custom_field.format.edit_tag self,
86 86
      custom_field_tag_id(prefix, custom_value.custom_field),
app/helpers/issues_helper.rb (working copy)
74 74
  end
75 75

  
76 76
  def render_issue_subject_with_tree(issue)
77
    s = ''
77
    s = +''
78 78
    ancestors = issue.root? ? [] : issue.ancestors.visible.to_a
79 79
    ancestors.each do |ancestor|
80 80
      s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
......
91 91

  
92 92
  def render_descendants_tree(issue)
93 93
    manage_relations = User.current.allowed_to?(:manage_subtasks, issue.project)
94
    s = '<table class="list issues odd-even">'
94
    s = +'<table class="list issues odd-even">'
95 95
    issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level|
96
      css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
96
      css = +"issue issue-#{child.id} hascontextmenu #{child.css_classes}"
97 97
      css << " idnt idnt-#{level}" if level > 0
98 98
      buttons = manage_relations ? link_to(l(:label_delete_link_to_subtask),
99 99
                                  issue_path({:id => child.id, :issue => {:parent_issue_id => ''}, :back_url => issue_path(issue.id), :no_flash => '1'}),
......
121 121
  def render_issue_relations(issue, relations)
122 122
    manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project)
123 123

  
124
    s = ''.html_safe
124
    s = (+'').html_safe
125 125
    relations.each do |relation|
126 126
      other_issue = relation.other_issue(issue)
127 127
      css = "issue hascontextmenu #{other_issue.css_classes}"
......
156 156
        l_hours_short(issue.estimated_hours)
157 157
      else
158 158
        s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
159
        s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
159
        s += " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
160 160
        s.html_safe
161 161
      end
162 162
    end
......
170 170
        link_to(l_hours_short(issue.spent_hours), path)
171 171
      else
172 172
        s = issue.spent_hours > 0 ? l_hours_short(issue.spent_hours) : ""
173
        s << " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), path})"
173
        s += " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), path})"
174 174
        s.html_safe
175 175
      end
176 176
    end
app/helpers/projects_helper.rb (working copy)
42 42
      selected = (parent_id.blank? ? nil : Project.find(parent_id))
43 43
    end
44 44

  
45
    options = ''
45
    options = +''
46 46
    options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
47 47
    options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
48 48
    content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
49 49
  end
50 50

  
51 51
  def render_project_action_links
52
    links = "".html_safe
52
    links = (+"").html_safe
53 53
    if User.current.allowed_to?(:add_project, nil, :global => true)
54 54
      links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add')
55 55
    end
app/helpers/queries_helper.rb (working copy)
290 290
    session_key = klass.name.underscore.to_sym
291 291

  
292 292
    if params[:query_id].present?
293
      cond = "project_id IS NULL"
294
      cond << " OR project_id = #{@project.id}" if @project
295
      @query = klass.where(cond).find(params[:query_id])
293
      scope = klass.where(:project_id => nil)
294
      scope = scope.or(klass.where(:project_id => @project)) if @project
295
      @query = scope.find(params[:query_id])
296 296
      raise ::Unauthorized unless @query.visible?
297 297
      @query.project = @project
298 298
      session[session_key] = {:id => @query.id, :project_id => @query.project_id} if use_session
......
389 389
    content_tag('h3', title) + "\n" +
390 390
      content_tag('ul',
391 391
        queries.collect {|query|
392
            css = 'query'
392
            css = +'query'
393 393
            css << ' selected' if query == @query
394 394
            content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css))
395 395
          }.join("\n").html_safe,
app/helpers/repositories_helper.rb (working copy)
87 87

  
88 88
  def render_changes_tree(tree)
89 89
    return '' if tree.nil?
90
    output = ''
90
    output = +''
91 91
    output << '<ul>'
92 92
    tree.keys.sort.each do |file|
93
      style = 'change'
93
      style = +'change'
94 94
      text = File.basename(h(file))
95 95
      if s = tree[file][:s]
96 96
        style << ' folder'
app/helpers/search_helper.rb (working copy)
22 22
    return text unless text && tokens && !tokens.empty?
23 23
    re_tokens = tokens.collect {|t| Regexp.escape(t)}
24 24
    regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE
25
    result = ''
25
    result = +''
26 26
    text.split(regexp).each_with_index do |words, i|
27 27
      if result.length > 1200
28 28
        # maximum length of the preview reached
app/helpers/wiki_helper.rb (working copy)
22 22

  
23 23
  def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0)
24 24
    pages = pages.group_by(&:parent) unless pages.is_a?(Hash)
25
    s = ''.html_safe
25
    s = (+'').html_safe
26 26
    if pages.has_key?(parent)
27 27
      pages[parent].each do |page|
28
        attrs = "value='#{page.id}'"
28
        attrs = +"value='#{page.id}'"
29 29
        attrs << " selected='selected'" if selected == page
30 30
        indent = (level > 0) ? ('&nbsp;' * level * 2 + '&#187; ') : ''
31 31

  
app/models/issue.rb (working copy)
1350 1350

  
1351 1351
  # Returns a string of css classes that apply to the issue
1352 1352
  def css_classes(user=User.current)
1353
    s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1353
    s = +"issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1354 1354
    s << ' closed' if closed?
1355 1355
    s << ' overdue' if overdue?
1356 1356
    s << ' child' if child?
app/models/journal.rb (working copy)
124 124

  
125 125
  # Returns a string of css classes
126 126
  def css_classes
127
    s = 'journal'
127
    s = +'journal'
128 128
    s << ' has-notes' unless notes.blank?
129 129
    s << ' has-details' unless details.blank?
130 130
    s << ' private-notes' if private_notes?
app/models/mailer.rb (working copy)
78 78
    @user = user
79 79
    @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
80 80
    subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]"
81
    subject << " (#{issue.status.name})" if Setting.show_status_changes_in_mail_subject?
82
    subject << " #{issue.subject}"
81
    subject += " (#{issue.status.name})" if Setting.show_status_changes_in_mail_subject?
82
    subject += " #{issue.subject}"
83 83
    mail :to => user,
84 84
      :subject => subject
85 85
  end
......
106 106
    references issue
107 107
    @author = journal.user
108 108
    s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
109
    s << "(#{issue.status.name}) " if journal.new_value_for('status_id') && Setting.show_status_changes_in_mail_subject?
110
    s << issue.subject
109
    s += "(#{issue.status.name}) " if journal.new_value_for('status_id') && Setting.show_status_changes_in_mail_subject?
110
    s += issue.subject
111 111
    @issue = issue
112 112
    @user = user
113 113
    @journal = journal
app/models/principal.rb (working copy)
69 69
      where({})
70 70
    else
71 71
      pattern = "%#{q}%"
72
      sql = "LOWER(#{table_name}.login) LIKE LOWER(:p)"
72
      sql = +"LOWER(#{table_name}.login) LIKE LOWER(:p)"
73 73
      sql << " OR #{table_name}.id IN (SELECT user_id FROM #{EmailAddress.table_name} WHERE LOWER(address) LIKE LOWER(:p))"
74 74
      params = {:p => pattern}
75 75

  
app/models/project.rb (working copy)
179 179
    base_statement = (perm && perm.read? ? "#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED}" : "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}")
180 180
    if !options[:skip_pre_condition] && perm && perm.project_module
181 181
      # If the permission belongs to a project module, make sure the module is enabled
182
      base_statement << " AND EXISTS (SELECT 1 AS one FROM #{EnabledModule.table_name} em WHERE em.project_id = #{Project.table_name}.id AND em.name='#{perm.project_module}')"
182
      base_statement += " AND EXISTS (SELECT 1 AS one FROM #{EnabledModule.table_name} em WHERE em.project_id = #{Project.table_name}.id AND em.name='#{perm.project_module}')"
183 183
    end
184 184
    if project = options[:project]
185 185
      project_statement = project.project_condition(options[:with_subprojects])
......
620 620
  end
621 621

  
622 622
  def css_classes
623
    s = 'project'
623
    s = +'project'
624 624
    s << ' root' if root?
625 625
    s << ' child' if child?
626 626
    s << (leaf? ? ' leaf' : ' parent')
app/models/query.rb (working copy)
1142 1142
      end
1143 1143
    when "!*"
1144 1144
      sql = "#{db_table}.#{db_field} IS NULL"
1145
      sql << " OR #{db_table}.#{db_field} = ''" if (is_custom_filter || [:text, :string].include?(type_for(field)))
1145
      sql += " OR #{db_table}.#{db_field} = ''" if (is_custom_filter || [:text, :string].include?(type_for(field)))
1146 1146
    when "*"
1147 1147
      sql = "#{db_table}.#{db_field} IS NOT NULL"
1148
      sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
1148
      sql += " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
1149 1149
    when ">="
1150 1150
      if [:date, :date_past].include?(type_for(field))
1151 1151
        sql = date_clause(db_table, db_field, parse_date(value.first), nil, is_custom_filter)
app/models/repository.rb (working copy)
232 232

  
233 233
  def diff_format_revisions(cs, cs_to, sep=':')
234 234
    text = ""
235
    text << cs_to.format_identifier + sep if cs_to
236
    text << cs.format_identifier if cs
235
    text += cs_to.format_identifier + sep if cs_to
236
    text += cs.format_identifier if cs
237 237
    text
238 238
  end
239 239

  
app/models/user.rb (working copy)
367 367
  def random_password(length=40)
368 368
    chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
369 369
    chars -= %w(0 O 1 l)
370
    password = ''
370
    password = +''
371 371
    length.times {|i| password << chars[SecureRandom.random_number(chars.size)] }
372 372
    self.password = password
373 373
    self.password_confirmation = password
config/initializers/10-patches.rb (working copy)
125 125
module ActionMailer
126 126
  class LogSubscriber < ActiveSupport::LogSubscriber
127 127
    def deliver(event)
128
      recipients = [:to, :cc, :bcc].inject("") do |s, header|
128
      recipients = [:to, :cc, :bcc].inject(+"") do |s, header|
129 129
        r = Array.wrap(event.payload[header])
130 130
        if r.any?
131 131
          s << "\n  #{header}: #{r.join(', ')}"
lib/plugins/gravatar/lib/gravatar.rb (working copy)
61 61
    
62 62
    # Returns the base Gravatar URL for the given email hash
63 63
    def gravatar_api_url(hash)
64
      "//www.gravatar.com/avatar/#{hash}"
64
      +"//www.gravatar.com/avatar/#{hash}"
65 65
    end
66 66

  
67 67
    # Return the gravatar URL for the given email address.
lib/plugins/open_id_authentication/lib/open_id_authentication.rb (working copy)
87 87
    # dodge XRIs -- TODO: validate, don't just skip.
88 88
    unless ['=', '@', '+', '$', '!', '('].include?(identifier.at(0))
89 89
      # does it begin with http?  if not, add it.
90
      identifier = "http://#{identifier}" unless identifier =~ /^http/i
90
      identifier = +"http://#{identifier}" unless identifier =~ /^http/i
91 91

  
92 92
      # strip any fragments
93 93
      identifier.gsub!(/\#(.*)$/, '')
lib/redmine/codeset_util.rb (working copy)
4 4

  
5 5
    def self.replace_invalid_utf8(str)
6 6
      return str if str.nil?
7
      str = str.dup if str.frozen?
7 8
      str.force_encoding('UTF-8')
8 9
      if ! str.valid_encoding?
9 10
        str = str.encode("UTF-16LE", :invalid => :replace,
......
14 15

  
15 16
    def self.to_utf8(str, encoding)
16 17
      return str if str.nil?
18
      str = str.dup if str.frozen?
17 19
      str.force_encoding("ASCII-8BIT")
18 20
      if str.empty?
19 21
        str.force_encoding("UTF-8")
......
37 39

  
38 40
    def self.to_utf8_by_setting_internal(str)
39 41
      return str if str.nil?
42
      str = str.dup if str.frozen?
40 43
      str.force_encoding('ASCII-8BIT')
41 44
      return str if str.empty?
42 45
      return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
......
56 59

  
57 60
    def self.from_utf8(str, encoding)
58 61
      str ||= ''
62
      str = str.dup if str.frozen?
59 63
      str.force_encoding('UTF-8')
60 64
      if encoding.upcase != 'UTF-8'
61 65
        str = str.encode(encoding, :invalid => :replace,
lib/redmine/export/csv.rb (working copy)
35 35
            col_sep = l(:general_csv_separator)
36 36
            encoding = Encoding.find(options[:encoding]) rescue Encoding.find(l(:general_csv_encoding))
37 37

  
38
            str = ''.force_encoding(encoding)
38
            str = (+'').force_encoding(encoding)
39 39
            if encoding == Encoding::UTF_8
40 40
              # BOM
41
              str = "\xEF\xBB\xBF".force_encoding(encoding)
41
              str = (+"\xEF\xBB\xBF").force_encoding(encoding)
42 42
            end
43 43

  
44 44
            super(str, :col_sep => col_sep, :encoding => encoding, &block)
lib/redmine/export/pdf.rb (working copy)
91 91
          </style>'
92 92

  
93 93
          # Strip {{toc}} tags
94
          txt.gsub!(/<p>\{\{([<>]?)toc\}\}<\/p>/i, '')
94
          txt = txt.gsub(/<p>\{\{([<>]?)toc\}\}<\/p>/i, '')
95 95
          writeHTMLCell(w, h, x, y, css_tag + txt, border, ln, fill)
96 96
        end
97 97

  
lib/redmine/export/pdf/issues_pdf_helper.rb (working copy)
305 305
            if query.grouped? &&
306 306
                 (group = query.group_by_column.group_value(issue)) != previous_group
307 307
              pdf.SetFontStyle('B',10)
308
              group_label = group.blank? ? 'None' : group.to_s.dup
308
              group_label = group.blank? ? +'None' : group.to_s.dup
309 309
              group_label << " (#{result_count_by_group[group]})"
310 310
              pdf.bookmark group_label, 0, -1
311 311
              pdf.RDMCell(table_width, row_height * 2, group_label, 'LR', 1, 'L')
lib/redmine/field_format.rb (working copy)
184 184
      def parse_keyword(custom_field, keyword, &block)
185 185
        separator = Regexp.escape ","
186 186
        keyword = keyword.to_s
187
        keyword = keyword.dup if keyword.frozen?
187 188

  
188 189
        if custom_field.multiple?
189 190
          values = []
lib/redmine/helpers/diff.rb (working copy)
44 44
          add_at = nil
45 45
          add_to = nil
46 46
          del_at = nil
47
          deleted = ""
47
          deleted = +""
48 48
          diff.each do |change|
49 49
            pos = change[1]
50 50
            if change[0] == "+"
lib/redmine/helpers/gantt.rb (working copy)
74 74
        end
75 75
        @date_from = Date.civil(@year_from, @month_from, 1)
76 76
        @date_to = (@date_from >> @months) - 1
77
        @subjects = ''
78
        @lines = ''
77
        @subjects = +''
78
        @lines = +''
79 79
        @number_of_rows = nil
80 80
        @truncated = false
81 81
        if options.has_key?(:max_rows)
......
196 196
                   :indent_increment => 20, :render => :subject,
197 197
                   :format => :html}.merge(options)
198 198
        indent = options[:indent] || 4
199
        @subjects = '' unless options[:only] == :lines
200
        @lines = '' unless options[:only] == :subjects
199
        @subjects = +'' unless options[:only] == :lines
200
        @lines = +'' unless options[:only] == :subjects
201 201
        @number_of_rows = 0
202 202
        begin
203 203
          Project.project_tree(projects) do |project, level|
......
650 650
        case object
651 651
        when Issue
652 652
          issue = object
653
          css_classes = ''
653
          css_classes = +''
654 654
          css_classes << ' issue-overdue' if issue.overdue?
655 655
          css_classes << ' issue-behind-schedule' if issue.behind_schedule?
656 656
          css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to
......
661 661
            css_classes << ' behind-start-date' if progress_date < self.date_from
662 662
            css_classes << ' over-end-date' if progress_date > self.date_to
663 663
          end
664
          s = "".html_safe
664
          s = (+"").html_safe
665 665
          if issue.assigned_to.present?
666 666
            assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name
667 667
            s << view.avatar(issue.assigned_to,
......
674 674
          view.content_tag(:span, s, :class => css_classes).html_safe
675 675
        when Version
676 676
          version = object
677
          html_class = ""
677
          html_class = +""
678 678
          html_class << 'icon icon-package '
679 679
          html_class << (version.behind_schedule? ? 'version-behind-schedule' : '') << " "
680 680
          html_class << (version.overdue? ? 'version-overdue' : '')
......
689 689
          view.content_tag(:span, s, :class => html_class).html_safe
690 690
        when Project
691 691
          project = object
692
          html_class = ""
692
          html_class = +""
693 693
          html_class << 'icon icon-projects '
694 694
          html_class << (project.overdue? ? 'project-overdue' : '')
695 695
          s = view.link_to_project(project).html_safe
......
725 725
        end
726 726
        if has_children
727 727
          content = view.content_tag(:span, nil, :class => :expander) + content
728
          tag_options[:class] << ' open'
728
          tag_options[:class] += ' open'
729 729
        else
730 730
          if params[:indent]
731 731
            params = params.dup
......
733 733
          end
734 734
        end
735 735
        style = "position: absolute;top:#{params[:top]}px;left:#{params[:indent]}px;"
736
        style << "width:#{params[:subject_width] - params[:indent]}px;" if params[:subject_width]
736
        style += "width:#{params[:subject_width] - params[:indent]}px;" if params[:subject_width]
737 737
        tag_options[:style] = style
738 738
        output = view.content_tag(:div, content, tag_options)
739 739
        @subjects << output
......
772 772
      end
773 773

  
774 774
      def html_task(params, coords, markers, label, object)
775
        output = ''
775
        output = +''
776 776
        data_options = {}
777 777
        data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object
778 778

  
......
790 790
        # Renders the task bar, with progress and late
791 791
        if coords[:bar_start] && coords[:bar_end]
792 792
          width = coords[:bar_end] - coords[:bar_start] - 2
793
          style = ""
793
          style = +""
794 794
          style << "top:#{params[:top]}px;"
795 795
          style << "left:#{coords[:bar_start]}px;"
796 796
          style << "width:#{width}px;"
......
810 810
          output << view.content_tag(:div, '&nbsp;'.html_safe, content_opt)
811 811
          if coords[:bar_late_end]
812 812
            width = coords[:bar_late_end] - coords[:bar_start] - 2
813
            style = ""
813
            style = +""
814 814
            style << "top:#{params[:top]}px;"
815 815
            style << "left:#{coords[:bar_start]}px;"
816 816
            style << "width:#{width}px;"
......
821 821
          end
822 822
          if coords[:bar_progress_end]
823 823
            width = coords[:bar_progress_end] - coords[:bar_start] - 2
824
            style = ""
824
            style = +""
825 825
            style << "top:#{params[:top]}px;"
826 826
            style << "left:#{coords[:bar_start]}px;"
827 827
            style << "width:#{width}px;"
......
837 837
        # Renders the markers
838 838
        if markers
839 839
          if coords[:start]
840
            style = ""
840
            style = +""
841 841
            style << "top:#{params[:top]}px;"
842 842
            style << "left:#{coords[:start]}px;"
843 843
            style << "width:15px;"
......
847 847
                                       :data => data_options)
848 848
          end
849 849
          if coords[:end]
850
            style = ""
850
            style = +""
851 851
            style << "top:#{params[:top]}px;"
852 852
            style << "left:#{coords[:end] + params[:zoom]}px;"
853 853
            style << "width:15px;"
......
859 859
        end
860 860
        # Renders the label on the right
861 861
        if label
862
          style = ""
862
          style = +""
863 863
          style << "top:#{params[:top]}px;"
864 864
          style << "left:#{(coords[:bar_end] || 0) + 8}px;"
865 865
          style << "width:15px;"
......
874 874
                               view.render_issue_tooltip(object).html_safe,
875 875
                               :class => "tip")
876 876
          s += view.content_tag(:input, nil, :type => 'checkbox', :name => 'ids[]', :value => object.id, :style => 'display:none;', :class => 'toggle-selection')
877
          style = ""
877
          style = +""
878 878
          style << "position: absolute;"
879 879
          style << "top:#{params[:top]}px;"
880 880
          style << "left:#{coords[:bar_start]}px;"
lib/redmine/info.rb (working copy)
7 7
      def versioned_name; "#{app_name} #{Redmine::VERSION}" end
8 8

  
9 9
      def environment
10
        s = "Environment:\n"
10
        s = +"Environment:\n"
11 11
        s << [
12 12
          ["Redmine version", Redmine::VERSION],
13 13
          ["Ruby version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"],
lib/redmine/pagination.rb (working copy)
159 159
        per_page_links = false if count.nil?
160 160
        page_param = paginator.page_param
161 161

  
162
        html = '<ul class="pages">'
162
        html = +'<ul class="pages">'
163 163

  
164 164
        if paginator.multiple_pages?
165 165
          # \xc2\xab(utf-8) = &#171;
lib/redmine/scm/adapters/abstract_adapter.rb (working copy)
276 276
        def scm_iconv(to, from, str)
277 277
          return nil if str.nil?
278 278
          return str if to == from && str.encoding.to_s == from
279
          str = str.dup if str.frozen?
279 280
          str.force_encoding(from)
280 281
          begin
281 282
            str.encode(to)
lib/redmine/scm/adapters/cvs_adapter.rb (working copy)
91 91
        def entries(path=nil, identifier=nil, options={})
92 92
          logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
93 93
          path_locale = scm_iconv(@path_encoding, 'UTF-8', path)
94
          path_locale.force_encoding("ASCII-8BIT")
94
          path_locale = path_locale.dup.force_encoding("ASCII-8BIT")
95 95
          entries = Entries.new
96 96
          cmd_args = %w|-q rls -e|
97 97
          cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
lib/redmine/scm/adapters/git_adapter.rb (working copy)
201 201
          cmd_args << "--" << scm_iconv(@path_encoding, 'UTF-8', path) if path && !path.empty?
202 202
          revisions = []
203 203
          if identifier_from || identifier_to
204
            revisions << ""
204
            revisions << +""
205 205
            revisions[0] << "#{identifier_from}.." if identifier_from
206 206
            revisions[0] << "#{identifier_to}" if identifier_to
207 207
          else
......
259 259
                end
260 260
              elsif (parsing_descr == 0) && line.chomp.to_s == ""
261 261
                parsing_descr = 1
262
                changeset[:description] = ""
262
                changeset[:description] = +""
263 263
              elsif (parsing_descr == 1 || parsing_descr == 2) \
264 264
                  && line =~ /^:\d+\s+\d+\s+[0-9a-f.]+\s+[0-9a-f.]+\s+(\w)\t(.+)$/
265 265
                parsing_descr = 2
lib/redmine/scm/adapters/subversion_adapter.rb (working copy)
89 89
          path ||= ''
90 90
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
91 91
          entries = Entries.new
92
          cmd = "#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
92
          cmd = +"#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
93 93
          cmd << credentials_string
94 94
          shellout(cmd) do |io|
95 95
            output = io.read.force_encoding('UTF-8')
......
242 242
        private
243 243

  
244 244
        def credentials_string
245
          str = ''
245
          str = +''
246 246
          str << " --username #{shell_quote(@login)}" unless @login.blank?
247 247
          str << " --password #{shell_quote(@password)}" unless @login.blank? || @password.blank?
248 248
          str << " --no-auth-cache --non-interactive"
lib/redmine/unified_diff.rb (working copy)
272 272

  
273 273
    def line_to_html_raw(line, offsets)
274 274
      if offsets
275
        s = ''
275
        s = +''
276 276
        unless offsets.first == 0
277 277
          s << CGI.escapeHTML(line[0..offsets.first-1])
278 278
        end
lib/redmine/wiki_formatting/markdown/formatter.rb (working copy)
81 81
        end
82 82

  
83 83
        def extract_sections(index)
84
          sections = ['', '', '']
84
          sections = [+'', +'', +'']
85 85
          offset = 0
86 86
          i = 0
87 87
          l = 1
lib/redmine/wiki_formatting/textile/formatter.rb (working copy)
63 63
          @pre_list = []
64 64
          text = self.dup
65 65
          rip_offtags text, false, false
66
          before = ''
67
          s = ''
68
          after = ''
66
          before = +''
67
          s = +''
68
          after = +''
69 69
          i = 0
70 70
          l = 1
71 71
          started = false
lib/redmine/wiki_formatting/textile/redcloth3.rb (working copy)
466 466
    # Parses Textile attribute lists and builds an HTML attribute string
467 467
    def pba( text_in, element = "" )
468 468
        
469
        return '' unless text_in
469
        return +'' unless text_in
470 470

  
471 471
        style = []
472 472
        text = text_in.dup
......
504 504

  
505 505
        id = id.starts_with?('wiki-id-') ? id : "wiki-id-#{id}" if id
506 506

  
507
        atts = ''
507
        atts = +''
508 508
        atts << " style=\"#{ style.join }\"" unless style.empty?
509 509
        atts << " class=\"#{ cls }\"" unless cls.to_s.empty?
510 510
        atts << " lang=\"#{ lang }\"" if lang
......
585 585
                        depth << tl
586 586
                        atts = pba( atts )
587 587
                        atts = shelve( atts ) if atts
588
                        lines[line_id] = "\t<#{ lT(tl) }l#{ atts }>\n\t<li>#{ content }"
588
                        lines[line_id] = +"\t<#{ lT(tl) }l#{ atts }>\n\t<li>#{ content }"
589 589
                    else
590
                        lines[line_id] = "\t\t<li>#{ content }"
590
                        lines[line_id] = +"\t\t<li>#{ content }"
591 591
                    end
592 592
                    last_line = line_id
593 593

  
......
610 610
    def block_textile_quotes( text )
611 611
      text.gsub!( QUOTES_RE ) do |match|
612 612
        lines = match.split( /\n/ )
613
        quotes = ''
613
        quotes = +''
614 614
        indent = 0
615 615
        lines.each do |line|
616 616
          line =~ QUOTES_CONTENT_RE 
......
638 638
        text.gsub!( CODE_RE ) do |m|
639 639
            before,lang,code,after = $~[1..4]
640 640
            lang = " lang=\"#{ lang }\"" if lang
641
            rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }", false )
641
            rip_offtags( +"#{ before }<code#{ lang }>#{ code }</code>#{ after }", false )
642 642
        end
643 643
    end
644 644

  
......
850 850
              post = ")"+post # add closing parenth to post
851 851
            end
852 852
            atts = pba( atts )
853
            atts = " href=\"#{ htmlesc url }#{ slash }\"#{ atts }"
853
            atts = +" href=\"#{ htmlesc url }#{ slash }\"#{ atts }"
854 854
            atts << " title=\"#{ htmlesc title }\"" if title
855 855
            atts = shelve( atts ) if atts
856 856
            
......
961 961
            stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
962 962
            htmlesc title
963 963
            atts = pba( atts )
964
            atts = " src=\"#{ htmlesc url.dup }\"#{ atts }"
964
            atts = +" src=\"#{ htmlesc url.dup }\"#{ atts }"
965 965
            atts << " title=\"#{ title }\"" if title
966 966
            atts << " alt=\"#{ title }\"" 
967 967
            # size = @getimagesize($url);
......
972 972

  
973 973
            next m unless uri_with_safe_scheme?(url)
974 974

  
975
            out = ''
975
            out = +''
976 976
            out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href
977 977
            out << "<img#{ shelve( atts ) } />"
978 978
            out << "</a>#{ href_a1 }#{ href_a2 }" if href
......
1095 1095
                    if codepre - used_offtags.length > 0
1096 1096
                        htmlesc( line, :NoQuotes ) if escape_line
1097 1097
                        @pre_list.last << line
1098
                        line = ""
1098
                        line = +""
1099 1099
                    else
1100 1100
                        ### htmlesc is disabled between CODE tags which will be parsed with highlighter
1101 1101
                        ### Regexp in formatter.rb is : /<code\s+class="(\w+)">\s?(.+)/m
1102 1102
                        ### NB: some changes were made not to use $N variables, because we use "match"
1103 1103
                        ###   and it breaks following lines
1104 1104
                        htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag && !first.match(/<code\s+class="(\w+)">/)
1105
                        line = "<redpre##{ @pre_list.length }>"
1105
                        line = +"<redpre##{ @pre_list.length }>"
1106 1106
                        first.match(/<#{ OFFTAGS }([^>]*)>/)
1107 1107
                        tag = $1
1108 1108
                        $2.to_s.match(/(class\=("[^"]+"|'[^']+'))/i)
1109 1109
                        tag << " #{$1}" if $1 && tag == 'code'
1110
                        @pre_list << "<#{ tag }>#{ aftertag }"
1110
                        @pre_list << +"<#{ tag }>#{ aftertag }"
1111 1111
                    end
1112 1112
                elsif $1 and codepre > 0
1113 1113
                    if codepre - used_offtags.length > 0
1114 1114
                        htmlesc( line, :NoQuotes ) if escape_line
1115 1115
                        @pre_list.last << line
1116
                        line = ""
1116
                        line = +""
1117 1117
                    end
1118 1118
                    codepre -= 1 unless codepre.zero?
1119 1119
                    used_offtags = {} if codepre.zero?
test/functional/attachments_controller_test.rb (working copy)
143 143
    assert a.save
144 144
    assert_equal 'japanese-utf-8.txt', a.filename
145 145

  
146
    str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e".force_encoding('UTF-8')
146
    str_japanese = (+"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e").force_encoding('UTF-8')
147 147

  
148 148
    get :show, :params => {
149 149
        :id => a.id
test/functional/issues_controller_test.rb (working copy)
770 770

  
771 771
  def test_index_csv_big_5
772 772
    with_settings :default_language => "zh-TW" do
773
      str_utf8  = "\xe4\xb8\x80\xe6\x9c\x88".force_encoding('UTF-8')
774
      str_big5  = "\xa4@\xa4\xeb".force_encoding('Big5')
773
      str_utf8  = (+"\xe4\xb8\x80\xe6\x9c\x88").force_encoding('UTF-8')
774
      str_big5  = (+"\xa4@\xa4\xeb").force_encoding('Big5')
775 775
      issue = Issue.generate!(:subject => str_utf8)
776 776

  
777 777
      get :index, :params => {
......
782 782
      assert_equal 'text/csv; header=present', @response.content_type
783 783
      lines = @response.body.chomp.split("\n")
784 784
      header = lines[0]
785
      status = "\xaa\xac\xbaA".force_encoding('Big5')
785
      status = (+"\xaa\xac\xbaA").force_encoding('Big5')
786 786
      assert_include status, header
787 787
      issue_line = lines.find {|l| l =~ /^#{issue.id},/}
788 788
      assert_include str_big5, issue_line
......
791 791

  
792 792
  def test_index_csv_cannot_convert_should_be_replaced_big_5
793 793
    with_settings :default_language => "zh-TW" do
794
      str_utf8  = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
794
      str_utf8  = (+"\xe4\xbb\xa5\xe5\x86\x85").force_encoding('UTF-8')
795 795
      issue = Issue.generate!(:subject => str_utf8)
796 796

  
797 797
      get :index, :params => {
......
805 805
      lines = @response.body.chomp.split("\n")
806 806
      header = lines[0]
807 807
      issue_line = lines.find {|l| l =~ /^#{issue.id},/}
808
      s1 = "\xaa\xac\xbaA".force_encoding('Big5') # status
808
      s1 = (+"\xaa\xac\xbaA").force_encoding('Big5') # status
809 809
      assert header.include?(s1)
810 810
      s2 = issue_line.split(",")[2]
811
      s3 = "\xa5H?".force_encoding('Big5') # subject
811
      s3 = (+"\xa5H?").force_encoding('Big5') # subject
812 812
      assert_equal s3, s2
813 813
    end
814 814
  end
......
2344 2344

  
2345 2345
  def test_export_to_pdf_with_utf8_u_fffd
2346 2346
    # U+FFFD
2347
    s = "\xef\xbf\xbd"
2348
    s.force_encoding('UTF-8') if s.respond_to?(:force_encoding)
2347
    s = +"\xef\xbf\xbd"
2348
    s.force_encoding('UTF-8')
2349 2349
    issue = Issue.generate!(:subject => s)
2350 2350
    ["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
2351 2351
      with_settings :default_language => lang do
test/functional/repositories_filesystem_controller_test.rb (working copy)
110 110
               "when Encoding.default_external is not UTF-8. " +
111 111
               "Current value is '#{Encoding.default_external.to_s}'"
112 112
        else
113
          str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e".force_encoding('UTF-8')
113
          str_japanese = (+"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e").force_encoding('UTF-8')
114 114
          assert_select 'tr#L3 td.line-code', :text => /#{str_japanese}/
115 115
        end
116 116
      end
test/functional/repositories_git_controller_test.rb (working copy)
26 26
  REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
27 27
  REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
28 28
  PRJ_ID     = 3
29
  CHAR_1_HEX = "\xc3\x9c".force_encoding('UTF-8')
30
  FELIX_HEX  = "Felix Sch\xC3\xA4fer".force_encoding('UTF-8')
29
  CHAR_1_HEX = (+"\xc3\x9c").force_encoding('UTF-8')
30
  FELIX_HEX  = (+"Felix Sch\xC3\xA4fer").force_encoding('UTF-8')
31 31
  NUM_REV = 28
32 32

  
33 33
  ## Git, Mercurial and CVS path encodings are binary.
test/functional/repositories_mercurial_controller_test.rb (working copy)
42 42
    assert @repository
43 43
    @diff_c_support = true
44 44
    @char_1        = CHAR_1_HEX.dup.force_encoding('UTF-8')
45
    @tag_char_1    = "tag-#{CHAR_1_HEX}-00".force_encoding('UTF-8')
46
    @branch_char_0 = "branch-#{CHAR_1_HEX}-00".force_encoding('UTF-8')
47
    @branch_char_1 = "branch-#{CHAR_1_HEX}-01".force_encoding('UTF-8')
45
    @tag_char_1    = (+"tag-#{CHAR_1_HEX}-00").force_encoding('UTF-8')
46
    @branch_char_0 = (+"branch-#{CHAR_1_HEX}-00").force_encoding('UTF-8')
47
    @branch_char_1 = (+"branch-#{CHAR_1_HEX}-01").force_encoding('UTF-8')
48 48
  end
49 49

  
50 50
  if ruby19_non_utf8_pass
test/functional/timelog_report_test.rb (working copy)
259 259
  end
260 260

  
261 261
  def test_csv_big_5
262
    str_utf8  = "\xe4\xb8\x80\xe6\x9c\x88".force_encoding('UTF-8')
263
    str_big5  = "\xa4@\xa4\xeb".force_encoding('Big5')
262
    str_utf8  = (+"\xe4\xb8\x80\xe6\x9c\x88").force_encoding('UTF-8')
263
    str_big5  = (+"\xa4@\xa4\xeb").force_encoding('Big5')
264 264
    user = User.find_by_id(3)
265 265
    user.firstname = str_utf8
266 266
    user.lastname  = "test-lastname"
......
292 292
    assert_equal 'text/csv; header=present', @response.content_type
293 293
    lines = @response.body.chomp.split("\n")
294 294
    # Headers
295
    s1 = "\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp".force_encoding('Big5')
296
    s2 = "\xa4u\xae\xc9\xc1`\xadp".force_encoding('Big5')
295
    s1 = (+"\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp").force_encoding('Big5')
296
    s2 = (+"\xa4u\xae\xc9\xc1`\xadp").force_encoding('Big5')
297 297
    assert_equal s1, lines.first
298 298
    # Total row
299 299
    assert_equal "#{str_big5} #{user.lastname},7.30,7.30", lines[1]
300 300
    assert_equal "#{s2},7.30,7.30", lines[2]
301 301

  
302
    str_tw = "Chinese/Traditional (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)".force_encoding('UTF-8')
302
    str_tw = (+"Chinese/Traditional (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)").force_encoding('UTF-8')
303 303
    assert_equal str_tw, l(:general_lang_name)
304 304
    assert_equal 'Big5', l(:general_csv_encoding)
305 305
    assert_equal ',', l(:general_csv_separator)
......
307 307
  end
308 308

  
309 309
  def test_csv_cannot_convert_should_be_replaced_big_5
310
    str_utf8  = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
310
    str_utf8  = (+"\xe4\xbb\xa5\xe5\x86\x85").force_encoding('UTF-8')
311 311
    user = User.find_by_id(3)
312 312
    user.firstname = str_utf8
313 313
    user.lastname  = "test-lastname"
......
339 339
    assert_equal 'text/csv; header=present', @response.content_type
340 340
    lines = @response.body.chomp.split("\n")
341 341
    # Headers
342
    s1 = "\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp".force_encoding('Big5')
342
    s1 = (+"\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp").force_encoding('Big5')
343 343
    assert_equal s1, lines.first
344 344
    # Total row
345
    s2 = "\xa5H?".force_encoding('Big5')
345
    s2 = (+"\xa5H?").force_encoding('Big5')
346 346
    assert_equal "#{s2} #{user.lastname},7.30,7.30", lines[1]
347 347
  end
348 348

  
......
374 374
      assert_equal 'text/csv; header=present', @response.content_type
375 375
      lines = @response.body.chomp.split("\n")
376 376
      # Headers
377
      s1 = "Utilisateur;2011-11-11;Temps total".force_encoding('ISO-8859-1')
378
      s2 = "Temps total".force_encoding('ISO-8859-1')
377
      s1 = (+"Utilisateur;2011-11-11;Temps total").force_encoding('ISO-8859-1')
378
      s2 = (+"Temps total").force_encoding('ISO-8859-1')
379 379
      assert_equal s1, lines.first
380 380
      # Total row
381 381
      assert_equal "#{user.firstname} #{user.lastname};7,30;7,30", lines[1]
382 382
      assert_equal "#{s2};7,30;7,30", lines[2]
383 383

  
384
      str_fr = "French (Fran\xc3\xa7ais)".force_encoding('UTF-8')
384
      str_fr = (+"French (Fran\xc3\xa7ais)").force_encoding('UTF-8')
385 385
      assert_equal str_fr, l(:general_lang_name)
386 386
      assert_equal 'ISO-8859-1', l(:general_csv_encoding)
387 387
      assert_equal ';', l(:general_csv_separator)
test/helpers/application_helper_test.rb (working copy)
37 37
  def setup
38 38
    super
39 39
    set_tmp_attachments_directory
40
    @russian_test = "\xd1\x82\xd0\xb5\xd1\x81\xd1\x82".force_encoding('UTF-8')
40
    @russian_test = (+"\xd1\x82\xd0\xb5\xd1\x81\xd1\x82").force_encoding('UTF-8')
41 41
  end
42 42

  
43 43
  test "#link_to_if_authorized for authorized user should allow using the :controller and :action for the target link" do
......
1424 1424
  end
1425 1425

  
1426 1426
  def test_parse_redmine_links_should_handle_a_tag_without_attributes
1427
    text = '<a>http://example.com</a>'
1427
    text = +'<a>http://example.com</a>'
1428 1428
    expected = text.dup
1429 1429
    parse_redmine_links(text, nil, nil, nil, true, {})
1430 1430
    assert_equal expected, text
......
1779 1779
  end
1780 1780

  
1781 1781
  def test_truncate_single_line_non_ascii
1782
    ja = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e".force_encoding('UTF-8')
1782
    ja = (+"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e").force_encoding('UTF-8')
1783 1783
    result = truncate_single_line_raw("#{ja}\n#{ja}\n#{ja}", 10)
1784 1784
    assert_equal "#{ja} #{ja}...", result
1785 1785
    assert !result.html_safe?
test/integration/api_test/authentication_test.rb (working copy)
110 110
  end
111 111

  
112 112
  def test_invalid_utf8_credentials_should_not_trigger_an_error
113
    invalid_utf8 = "\x82".force_encoding('UTF-8')
113
    invalid_utf8 = (+"\x82").force_encoding('UTF-8')
114 114
    assert !invalid_utf8.valid_encoding?
115 115
    assert_nothing_raised do
116 116
      get '/users/current.xml', :headers => credentials(invalid_utf8, "foo")
test/object_helpers.rb (working copy)
1 1
module ObjectHelpers
2 2
  def User.generate!(attributes={})
3
    @generated_user_login ||= 'user0'
3
    @generated_user_login ||= +'user0'
4 4
    @generated_user_login.succ!
5 5
    user = User.new(attributes)
6 6
    user.login = @generated_user_login.dup if user.login.blank?
......
19 19
  end
20 20

  
21 21
  def Group.generate!(attributes={})
22
    @generated_group_name ||= 'Group 0'
22
    @generated_group_name ||= +'Group 0'
23 23
    @generated_group_name.succ!
24 24
    group = Group.new(attributes)
25 25
    group.name = @generated_group_name.dup if group.name.blank?
......
29 29
  end
30 30

  
31 31
  def Project.generate!(attributes={})
32
    @generated_project_identifier ||= 'project-0000'
32
    @generated_project_identifier ||= +'project-0000'
33 33
    @generated_project_identifier.succ!
34 34
    project = Project.new(attributes)
35 35
    project.name = @generated_project_identifier.dup if project.name.blank?
......
51 51
  end
52 52

  
53 53
  def IssueStatus.generate!(attributes={})
54
    @generated_status_name ||= 'Status 0'
54
    @generated_status_name ||= +'Status 0'
55 55
    @generated_status_name.succ!
56 56
    status = IssueStatus.new(attributes)
57 57
    status.name = @generated_status_name.dup if status.name.blank?
......
61 61
  end
62 62

  
63 63
  def Tracker.generate(attributes={})
64
    @generated_tracker_name ||= 'Tracker 0'
64
    @generated_tracker_name ||= +'Tracker 0'
65 65
    @generated_tracker_name.succ!
66 66
    tracker = Tracker.new(attributes)
67 67
    tracker.name = @generated_tracker_name.dup if tracker.name.blank?
......
77 77
  end
78 78

  
79 79
  def Role.generate!(attributes={})
80
    @generated_role_name ||= 'Role 0'
80
    @generated_role_name ||= +'Role 0'
81 81
    @generated_role_name.succ!
82 82
    role = Role.new(attributes)
83 83
    role.name = @generated_role_name.dup if role.name.blank?
......
131 131
  end
132 132

  
133 133
  def Version.generate!(attributes={})
134
    @generated_version_name ||= 'Version 0'
134
    @generated_version_name ||= +'Version 0'
135 135
    @generated_version_name.succ!
136 136
    version = Version.new(attributes)
137 137
    version.name = @generated_version_name.dup if version.name.blank?
......
160 160
  end
161 161

  
162 162
  def AuthSource.generate!(attributes={})
163
    @generated_auth_source_name ||= 'Auth 0'
163
    @generated_auth_source_name ||= +'Auth 0'
164 164
    @generated_auth_source_name.succ!
165 165
    source = AuthSource.new(attributes)
166 166
    source.name = @generated_auth_source_name.dup if source.name.blank?
......
170 170
  end
171 171

  
172 172
  def Board.generate!(attributes={})
173
    @generated_board_name ||= 'Forum 0'
173
    @generated_board_name ||= +'Forum 0'
174 174
    @generated_board_name.succ!
175 175
    board = Board.new(attributes)
176 176
    board.name = @generated_board_name.dup if board.name.blank?
......
181 181
  end
182 182

  
183 183
  def Attachment.generate!(attributes={})
184
    @generated_filename ||= 'testfile0'
184
    @generated_filename ||= +'testfile0'
185 185
    @generated_filename.succ!
186 186
    attributes = attributes.dup
187 187
    attachment = Attachment.new(attributes)
......
193 193
  end
194 194

  
195 195
  def CustomField.generate!(attributes={})
196
    @generated_custom_field_name ||= 'Custom field 0'
196
    @generated_custom_field_name ||= +'Custom field 0'
197 197
    @generated_custom_field_name.succ!
198 198
    field = new(attributes)
199 199
    field.name = @generated_custom_field_name.dup if field.name.blank?
......
211 211
  end
212 212

  
213 213
  def Changeset.generate!(attributes={})
214
    @generated_changeset_rev ||= '123456'
214
    @generated_changeset_rev ||= +'123456'
215 215
    @generated_changeset_rev.succ!
216 216
    changeset = new(attributes)
217 217
    changeset.repository ||= Project.find(1).repository
test/unit/attachment_test.rb (working copy)
408 408
  end
409 409

  
410 410
  def test_latest_attach_should_not_error_with_string_with_invalid_encoding
411
    string = "width:50\xFE-Image.jpg".force_encoding('UTF-8')
411
    string = (+"width:50\xFE-Image.jpg").force_encoding('UTF-8')
412 412
    assert_equal false, string.valid_encoding?
413 413

  
414 414
    Attachment.latest_attach(Attachment.limit(2).to_a, string)
test/unit/changeset_test.rb (working copy)
449 449
  def test_comments_should_be_converted_to_utf8
450 450
    proj = Project.find(3)
451 451
    # str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
452
    str = "Texte encod\xe9 en ISO-8859-1.".force_encoding("ASCII-8BIT")
452
    str = (+"Texte encod\xe9 en ISO-8859-1.").force_encoding("ASCII-8BIT")
453 453
    r = Repository::Bazaar.create!(
454 454
            :project      => proj,
455 455
            :url          => '/tmp/test/bazaar',
......
461 461
                      :scmid        => '12345',
462 462
                      :comments     => str)
463 463
    assert( c.save )
464
    str_utf8 = "Texte encod\xc3\xa9 en ISO-8859-1.".force_encoding("UTF-8")
464
    str_utf8 = (+"Texte encod\xc3\xa9 en ISO-8859-1.").force_encoding("UTF-8")
465 465
    assert_equal str_utf8, c.comments
466 466
  end
467 467

  
468 468
  def test_invalid_utf8_sequences_in_comments_should_be_replaced_latin1
469 469
    proj = Project.find(3)
470 470
    # str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
471
    str1 = "Texte encod\xe9 en ISO-8859-1.".force_encoding("UTF-8")
472
    str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".force_encoding("ASCII-8BIT")
471
    str1 = (+"Texte encod\xe9 en ISO-8859-1.").force_encoding("UTF-8")
472
    str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT")
473 473
    r = Repository::Bazaar.create!(
474 474
            :project      => proj,
475 475
            :url          => '/tmp/test/bazaar',
......
488 488

  
489 489
  def test_invalid_utf8_sequences_in_comments_should_be_replaced_ja_jis
490 490
    proj = Project.find(3)
491
    str = "test\xb5\xfetest\xb5\xfe".force_encoding('ASCII-8BIT')
491
    str = (+"test\xb5\xfetest\xb5\xfe").force_encoding('ASCII-8BIT')
492 492
    r = Repository::Bazaar.create!(
493 493
            :project      => proj,
494 494
            :url          => '/tmp/test/bazaar',
......
504 504
  end
505 505

  
506 506
  def test_comments_should_be_converted_all_latin1_to_utf8
507
    s1 = "\xC2\x80"
508
    s2 = "\xc3\x82\xc2\x80"
507
    s1 = +"\xC2\x80"
508
    s2 = +"\xc3\x82\xc2\x80"
509 509
    s4 = s2.dup
510 510
    s3 = s1.dup
511 511
    s1.force_encoding('ASCII-8BIT')
......
530 530

  
531 531
  def test_invalid_utf8_sequences_in_paths_should_be_replaced
532 532
    proj = Project.find(3)
533
    str1 = "Texte encod\xe9 en ISO-8859-1".force_encoding("UTF-8")
534
    str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".force_encoding("ASCII-8BIT")
533
    str1 = (+"Texte encod\xe9 en ISO-8859-1").force_encoding("UTF-8")
534
    str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT")
535 535
    r = Repository::Bazaar.create!(
536 536
            :project => proj,
537 537
            :url => '/tmp/test/bazaar',
test/unit/custom_field_test.rb (working copy)
105 105

  
106 106
  def test_possible_values_should_return_utf8_encoded_strings
107 107
    field = CustomField.new
108
    s = "Value".force_encoding('BINARY')
108
    s = "Value".b
109 109
    field.possible_values = s
110 110
    assert_equal [s], field.possible_values
111 111
    assert_equal 'UTF-8', field.possible_values.first.encoding.name
test/unit/group_test.rb (working copy)
56 56

  
57 57
  def test_blank_name_error_message_fr
58 58
    set_language_if_valid 'fr'
59
    str = "Nom doit \xc3\xaatre renseign\xc3\xa9(e)".force_encoding('UTF-8')
59
    str = (+"Nom doit \xc3\xaatre renseign\xc3\xa9(e)").force_encoding('UTF-8')
60 60
    g = Group.new
61 61
    assert !g.save
62 62
    assert_include str, g.errors.full_messages
test/unit/lib/redmine/codeset_util_test.rb (working copy)
21 21

  
22 22
  def test_to_utf8_by_setting_from_latin1
23 23
    with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
24
      s1 = "Texte encod\xc3\xa9".force_encoding("UTF-8")
25
      s2 = "Texte encod\xe9".force_encoding("ASCII-8BIT")
24
      s1 = (+"Texte encod\xc3\xa9").force_encoding("UTF-8")
25
      s2 = (+"Texte encod\xe9").force_encoding("ASCII-8BIT")
26 26
      s3 = s2.dup.force_encoding("UTF-8")
27 27
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
28 28
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
......
31 31

  
32 32
  def test_to_utf8_by_setting_from_euc_jp
33 33
    with_settings :repositories_encodings => 'UTF-8,EUC-JP' do
34
      s1 = "\xe3\x83\xac\xe3\x83\x83\xe3\x83\x89\xe3\x83\x9e\xe3\x82\xa4\xe3\x83\xb3".force_encoding("UTF-8")
35
      s2 = "\xa5\xec\xa5\xc3\xa5\xc9\xa5\xde\xa5\xa4\xa5\xf3".force_encoding("ASCII-8BIT")
34
      s1 = (+"\xe3\x83\xac\xe3\x83\x83\xe3\x83\x89\xe3\x83\x9e\xe3\x82\xa4\xe3\x83\xb3").force_encoding("UTF-8")
35
      s2 = (+"\xa5\xec\xa5\xc3\xa5\xc9\xa5\xde\xa5\xa4\xa5\xf3").force_encoding("ASCII-8BIT")
36 36
      s3 = s2.dup.force_encoding("UTF-8")
37 37
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
38 38
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
......
41 41

  
42 42
  def test_to_utf8_by_setting_should_be_converted_all_latin1
43 43
    with_settings :repositories_encodings => 'ISO-8859-1' do
44
      s1 = "\xc3\x82\xc2\x80".force_encoding("UTF-8")
45
      s2 = "\xC2\x80".force_encoding("ASCII-8BIT")
44
      s1 = (+"\xc3\x82\xc2\x80").force_encoding("UTF-8")
45
      s2 = (+"\xC2\x80").force_encoding("ASCII-8BIT")
46 46
      s3 = s2.dup.force_encoding("UTF-8")
47 47
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
48 48
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
......
55 55
  end
56 56

  
57 57
  def test_to_utf8_by_setting_returns_ascii_as_utf8
58
    s1 = "ASCII".force_encoding("UTF-8")
58
    s1 = (+"ASCII").force_encoding("UTF-8")
59 59
    s2 = s1.dup.force_encoding("ISO-8859-1")
... This diff was truncated because it exceeds the maximum size that can be displayed.
(2-2/2)