aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>2025-08-11 13:06:24 -0600
committerGitHub <noreply@github.com>2025-08-11 13:06:24 -0600
commitdea500b26bc1bbeae53e5da5903ae68bd92e79cb (patch)
tree39c539ff0c53a7652e7e6ceae0a767ff6763be2a
parent47634e731a05a61343a6c2abc393ca23b315e0f4 (diff)
Update dependency UTF.Unknown to 2.6.0 (#14599)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Bond_009 <bond.009@outlook.com>
-rw-r--r--Directory.Packages.props2
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs12
2 files changed, 8 insertions, 6 deletions
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 90f1a6eb2..f075db3a6 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -87,7 +87,7 @@
<PackageVersion Include="TagLibSharp" Version="2.3.0" />
<PackageVersion Include="z440.atl.core" Version="7.3.0" />
<PackageVersion Include="TMDbLib" Version="2.2.0" />
- <PackageVersion Include="UTF.Unknown" Version="2.5.1" />
+ <PackageVersion Include="UTF.Unknown" Version="2.6.0" />
<PackageVersion Include="Xunit.Priority" Version="1.1.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
index 508d5be32..359927d4d 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
@@ -171,14 +171,15 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
using (var stream = await GetStream(fileInfo.Path, fileInfo.Protocol, cancellationToken).ConfigureAwait(false))
{
- var result = CharsetDetector.DetectFromStream(stream).Detected;
+ var result = await CharsetDetector.DetectFromStreamAsync(stream, cancellationToken).ConfigureAwait(false);
+ var detected = result.Detected;
stream.Position = 0;
- if (result is not null)
+ if (detected is not null)
{
- _logger.LogDebug("charset {CharSet} detected for {Path}", result.EncodingName, fileInfo.Path);
+ _logger.LogDebug("charset {CharSet} detected for {Path}", detected.EncodingName, fileInfo.Path);
- using var reader = new StreamReader(stream, result.Encoding);
+ using var reader = new StreamReader(stream, detected.Encoding);
var text = await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
return new MemoryStream(Encoding.UTF8.GetBytes(text));
@@ -938,7 +939,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
using (var stream = await GetStream(path, mediaSource.Protocol, cancellationToken).ConfigureAwait(false))
{
- var charset = CharsetDetector.DetectFromStream(stream).Detected?.EncodingName ?? string.Empty;
+ var result = await CharsetDetector.DetectFromStreamAsync(stream, cancellationToken).ConfigureAwait(false);
+ var charset = result.Detected?.EncodingName ?? string.Empty;
// UTF16 is automatically converted to UTF8 by FFmpeg, do not specify a character encoding
if ((path.EndsWith(".ass", StringComparison.Ordinal) || path.EndsWith(".ssa", StringComparison.Ordinal) || path.EndsWith(".srt", StringComparison.Ordinal))