Module: Solargraph::Source::EncodingFixes
- Included in:
- Solargraph::Source, Change
- Defined in:
- lib/solargraph/source/encoding_fixes.rb
Class Method Summary collapse
-
.normalize(string) ⇒ String
Convert strings to normalized UTF-8.
Class Method Details
.normalize(string) ⇒ String
Convert strings to normalized UTF-8.
12 13 14 15 16 17 18 19 20 |
# File 'lib/solargraph/source/encoding_fixes.rb', line 12 def normalize string begin string.dup.force_encoding('UTF-8') rescue ::Encoding::CompatibilityError, ::Encoding::UndefinedConversionError, ::Encoding::InvalidByteSequenceError => e # @todo Improve error handling Solargraph::Logging.logger.warn "Normalize error: #{e.}" string end end |