﻿id,summary,reporter,owner,description,type,status,priority,component,version,resolution,keywords,cc,blockedby,blocking,reproduced,analyzed
10356,Incorrect escaping text from srt subtitles,Ashark,,"Summary of the bug:
I want to literally place ""\n"" string (not actually a line break) to the video. I created an srt file and hardsubbed it with subtitle video vilter:

{{{
$ ffmpeg -hide_banner -loglevel error -y -f lavfi -i color=size=1280x720:rate=10:color=black -vf ""subtitles=subtitle_with_n.srt:force_style='Alignment=10,Fontsize=12'"" -frames:v 1 output.png
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.1 (GCC) 20230201
}}}

But the escaping is done wrong. To hardsub the ""\n"" string, I escape backslash in srt: ""\\n"". But instead of escaping the backslash, it escapes the n, and the first '\' is written as is.

I created this file subtitle_with_n.srt:
{{{
1
00:00:00,000 --> 10:00:00,000
line 1 &#x5c; &#92; &#0092; backslash ampersand entity (also tried N letter entity) neither work in vlc nor in ffmpeg.
line 2 \\n escapes n instead backslash. On vlc it makes backslash and breaks line. On ffmpeg it is backslash and space.
line 3 \⁠n used wordjoiner (U+2060), works
line 4 \​n zero width space, works in vlc, works in ffmpeg.
line 5 \n breaks line in vlc, make space in ffmpeg. <b>Bold</b> tag works in both.
line 6 \<i></i>n works for vlc, but in ffmpeg it is wrong.
}}}

This is self commenting. See screenshot for result.
The expected non-crutch way is escaping work as normal: going from left to right of the string. 

Additional info:
#9058 - bug about possibility to encode ampersand entities.
#9808 - similar bug about escaping in another type of subtitles
https://github.com/libass/libass/issues/194#issuecomment-351902555 - workaround by using word joiner symbol.",defect,new,normal,undetermined,6.0,,,Ashark,,,0,0
