##// END OF EJS Templates
use String#encode at scm_iconv on Ruby 1.9 (#12228)...
Toshi MARUYAMA -
r10525:5a2c80cb48c4
parent child
Show More
@@ -260,6 +260,15 module Redmine
260 def scm_iconv(to, from, str)
260 def scm_iconv(to, from, str)
261 return nil if str.nil?
261 return nil if str.nil?
262 return str if to == from
262 return str if to == from
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
263 begin
272 begin
264 Iconv.conv(to, from, str)
273 Iconv.conv(to, from, str)
265 rescue Iconv::Failure => err
274 rescue Iconv::Failure => err
@@ -267,6 +276,7 module Redmine
267 nil
276 nil
268 end
277 end
269 end
278 end
279 end
270
280
271 def parse_xml(xml)
281 def parse_xml(xml)
272 if RUBY_PLATFORM == 'java'
282 if RUBY_PLATFORM == 'java'
General Comments 0
You need to be logged in to leave comments. Login now