Module: PuppetForgeServer::Utils::Encoding
- Included in:
- Api::V3::Releases
- Defined in:
- lib/puppet_forge_server/utils/encoding.rb
Constant Summary collapse
- @@ic =
Iconv.new('UTF-8//IGNORE', 'UTF-8')
Instance Method Summary collapse
-
#to_utf8(text) ⇒ string
Converts give text to valid UTF-8.
Instance Method Details
#to_utf8(text) ⇒ string
Converts give text to valid UTF-8
27 28 29 30 31 32 33 34 |
# File 'lib/puppet_forge_server/utils/encoding.rb', line 27 def to_utf8(text) replaced = text unless replaced.nil? replaced = replaced.force_encoding("UTF-8") if is_ascii_8bit?(replaced) replaced = cleanup_utf8(replaced) end replaced end |