@@ -260,11 +260,21 module Redmine | |||
|
260 | 260 | def scm_iconv(to, from, str) |
|
261 | 261 | return nil if str.nil? |
|
262 | 262 | return str if to == from |
|
263 | begin | |
|
264 | Iconv.conv(to, from, str) | |
|
265 | rescue Iconv::Failure => err | |
|
266 | logger.error("failed to convert from #{from} to #{to}. #{err}") | |
|
267 | nil | |
|
263 | if str.respond_to?(:force_encoding) | |
|
264 | str.force_encoding(from) | |
|
265 | begin | |
|
266 | s = str.encode(to) | |
|
267 | rescue Exception => e | |
|
268 | logger.error("failed to convert from #{from} to #{to}. #{err}") | |
|
269 | nil | |
|
270 | end | |
|
271 | else | |
|
272 | begin | |
|
273 | Iconv.conv(to, from, str) | |
|
274 | rescue Iconv::Failure => err | |
|
275 | logger.error("failed to convert from #{from} to #{to}. #{err}") | |
|
276 | nil | |
|
277 | end | |
|
268 | 278 | end |
|
269 | 279 | end |
|
270 | 280 |
General Comments 0
You need to be logged in to leave comments.
Login now