@@ -154,6 +154,13 module RepositoriesHelper | |||
|
154 | 154 | str = str.encode("US-ASCII", :invalid => :replace, |
|
155 | 155 | :undef => :replace, :replace => '?').encode("UTF-8") |
|
156 | 156 | end |
|
157 | else | |
|
158 | # removes invalid UTF8 sequences | |
|
159 | begin | |
|
160 | str = Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3] | |
|
161 | rescue Iconv::InvalidEncoding | |
|
162 | # "UTF-8//IGNORE" is not supported on some OS | |
|
163 | end | |
|
157 | 164 | end |
|
158 | 165 | str |
|
159 | 166 | end |
General Comments 0
You need to be logged in to leave comments.
Login now