Ruby 1.9 doesn't support Unicode normalization yet

前端 未结 7 2329
渐次进展
渐次进展 2021-01-04 07:46

I\'m trying to port over some of my old rails apps to Ruby 1.9 and I keep getting warnings about how \"Ruby 1.9 doesn\'t support Unicode normalization yet.\" I\'ve tracked

7条回答
  •  渐次进展
    2021-01-04 08:01

    If you'd rather not monkey patch the Inflector module, you can also do this...

    Both of the following worked for me to silence this annoying "Ruby 1.9 doesn't support Unicode normalization yet" warning:

    silence_stream(STDERR) {
      whatever_code_caused_transliterate_to_be_called
    }
    

    or

    silence_warnings {
      whatever_code_caused_transliterate_to_be_called
    }
    

    This does have the disadvantage that it requires cluttering up your calling code, but it is a technique you can use generally whenever you don't want to see warnings or other output.

    activesupport provides silence_stream and silence_warnings in activesupport-2.3.11/lib/active_support/core_ext/kernel/reporting.rb

提交回复
热议问题