Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]: UTF-8 subtitle encoding not supported on old DLNA device. #72

Open
1 task done
nestingBiscuit opened this issue Jun 10, 2024 · 2 comments
Open
1 task done
Labels
bug This PR or Issue describes or fixes something that isn't working

Comments

@nestingBiscuit
Copy link

nestingBiscuit commented Jun 10, 2024

Please describe your bug

I have an older Samsung TV and it does not allow me to select UTF-8 as the subtitle encoding. It only has ISO-8859-X encodings to choose from.

Since Jellyfin always converts subtitle files to UTF-8, the decoding on the TV gets jumbled for special characters like 'é'. (See the images below)

After extensive testing, I have found that the TV does decode UTF-8 with BOM correctly.

It would be preferable if I were able to set the text encoding in the DLNA profile, but I do not have the expertise to tackle such a change. I have suggested it as a feature.

I was able to fix the issue by changing the subtitle encoding in:

https://github.com/jellyfin/jellyfin/blob/31aa44d23d12b5dbb5f9a131242cc82c9ef98f24/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs#L186

to UTF-8 with BOM:

// Create a UTF-8 encoding that supports a BOM.
Encoding utf8 = new UTF8Encoding(true);
byte[] utfBOM = [.. utf8.GetPreamble(), .. utf8.GetBytes(text)];
return new MemoryStream(utfBOM);

I have tested this change with the few DLNA devices I own and they all show subtitles as expected. (Including the old Samsung TV)

I would be happy to make a pull request if this fix is deemed appropriate.

Reproduction Steps

Play a video with an external subtitle file that includes special characters, on a device that does not support UTF-8.
I used this srt to test..

Jellyfin Version

10.9.0

if other:

10.9.6

Environment

- OS: macOS
- Clients: DLNA / web client
- Browser: Firefox
- Playback Method: Direct
- Hardware Acceleration:
- Plugins: DLNA

Jellyfin logs

[12:31:49] [INF] [1] Main: Startup complete 0:00:02.5552437
[12:31:51] [INF] [9] Emby.Server.Implementations.ScheduledTasks.TaskManager: Clean up collections and playlists Completed after 0 minute(s) and 0 seconds
[12:31:52] [INF] [9] Emby.Server.Implementations.ScheduledTasks.TaskManager: Update Plugins Completed after 0 minute(s) and 0 seconds
[12:31:53] [INF] [10] Jellyfin.Plugin.Dlna.Main.DlnaHost: DLNA Session created for [TV]Samsung LED40 - UE40H6410

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

UTF-8 error decoding:
UTF-8 error decoding
UTF-8-BOM correct decoding:
UTF-8-BOM correct decoding

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nestingBiscuit nestingBiscuit added the bug This PR or Issue describes or fixes something that isn't working label Jun 10, 2024
@jellyfin-bot
Copy link
Contributor

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • This bug report was not filed using the issue template.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@nestingBiscuit
Copy link
Author

I did file using the template, but I may have made an edit that triggered the bot :)

@oddstr13 oddstr13 transferred this issue from jellyfin/jellyfin Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This PR or Issue describes or fixes something that isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants