lib/rabbit/logger/stderr.rb in rabbit-2.0.9 vs lib/rabbit/logger/stderr.rb in rabbit-2.1.0

- old
+ new

@@ -7,12 +7,16 @@ class STDERR include Base private def do_log(severity, prog_name, message) + # TODO: Remove me. It is workaround until Ruby/GLib2 2.0.3 is released. + if message.encoding == Encoding::ASCII_8BIT + message.force_encoding("UTF-8") + end begin message = message.encode("locale") - rescue Encoding::Error + rescue EncodingError format = _("can't convert to current locale from UTF-8: %s") ::STDERR.puts(format % message) end ::STDERR.puts(format_severity(severity)) ::STDERR.print("[#{prog_name}]: ") if prog_name