Mercurial > hg > soundsoftware-site
comparison app/helpers/.svn/text-base/repositories_helper.rb.svn-base @ 120:cd2282d2aa55 cannam
Merge from the default branch. Note that this is not a valid SVN repository any more (use default, redmine-1.1 etc for SVN updates).
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:33:08 +0000 |
parents | af80e5618e9b 8661b858af72 |
children | eeebe205a056 |
comparison
equal
deleted
inserted
replaced
118:b859cc0c4fa1 | 120:cd2282d2aa55 |
---|---|
115 output << '</ul>' | 115 output << '</ul>' |
116 output | 116 output |
117 end | 117 end |
118 | 118 |
119 def to_utf8(str) | 119 def to_utf8(str) |
120 return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii | 120 if str.respond_to?(:force_encoding) |
121 str.force_encoding('UTF-8') | |
122 return str if str.valid_encoding? | |
123 else | |
124 return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii | |
125 end | |
126 | |
121 @encodings ||= Setting.repositories_encodings.split(',').collect(&:strip) | 127 @encodings ||= Setting.repositories_encodings.split(',').collect(&:strip) |
122 @encodings.each do |encoding| | 128 @encodings.each do |encoding| |
123 begin | 129 begin |
124 return Iconv.conv('UTF-8', encoding, str) | 130 return Iconv.conv('UTF-8', encoding, str) |
125 rescue Iconv::Failure | 131 rescue Iconv::Failure |