Module: Cohere::Transcribe::Internal::UTF8

Defined in:
lib/cohere/transcribe/internal/utf8.rb

Overview

Normalizes path/reference bytes without applying locale-dependent transcoding. Callers retain control over their public error type and message when the bytes are not valid UTF-8.

Class Method Summary collapse

Class Method Details

.normalize(value) ⇒ Object



12
13
14
15
# File 'lib/cohere/transcribe/internal/utf8.rb', line 12

def normalize(value)
  text = value.b.force_encoding(Encoding::UTF_8)
  text if text.valid_encoding?
end