Module: OllamaChat::Utils::UTF8Converter
- Included in:
- Chat, PNGMetadataExtractor, PNGMetadataExtractor
- Defined in:
- lib/ollama_chat/utils/utf8_converter.rb
Overview
A utility module for converting strings to UTF-8 encoding. This module provides methods to ensure text is properly encoded as UTF-8, replacing invalid or undefined characters to prevent encoding errors.
Instance Method Summary collapse
-
#convert_to_utf8(text) ⇒ String?
Converts the given text to UTF-8 encoding, replacing invalid or undefined characters.
Instance Method Details
#convert_to_utf8(text) ⇒ String?
Converts the given text to UTF-8 encoding, replacing invalid or undefined characters.
10 11 12 |
# File 'lib/ollama_chat/utils/utf8_converter.rb', line 10 def convert_to_utf8(text) text&.encode('UTF-8', invalid: :replace, undef: :replace) end |