SubtitleCharsetGuessed

data class SubtitleCharsetGuessed(val uri: String, val charset: String, val detected: String? = null) : PlaybackWarning

An external subtitle file whose encoding had to be guessed, or could not be decoded properly.

A byte-order mark or a file that validates as UTF-8 is a fact and says nothing. This fires when neither held: the text was read with charset on the balance of evidence, and it may be wrong. detected names a multi-byte East Asian encoding that the file appears to be in and that could not be read: the backend's parser has no table for it, or no table read the bytes. That is a different answer from "no idea" and worth telling apart.

The track still loads. Imperfect subtitles beat absent ones, and an application that shows this can offer the viewer an override rather than leaving them with mojibake and no reason: KitePlayer.reloadExternalSubtitle reads the file again in the encoding the viewer picks from SubtitleSource.ENCODINGS, whose names are every name charset and detected can carry. A file read in an encoding the application named, as SubtitleSource.encoding or SubtitleConfig.fallbackEncoding, raises none.

Constructors

Link copied to clipboard
constructor(uri: String, charset: String, detected: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val fields: Map<String, String>

The warning as key and value pairs, for a structured log sink.

Link copied to clipboard
open override val message: String
Link copied to clipboard
val uri: String

Functions

Link copied to clipboard
override fun toString(): String

The type and the message, with every URI cut to its file name, as for PlaybackError.