[vlc-devel] [PATCH 05/11] Fix rendering of HTML reserved characters
Rafaël Carré
funman at videolan.org
Mon Dec 31 00:48:44 CET 2012
Le 27/12/2012 07:08, Devin Heitmueller a écrit :
> If the character in the EIA-608 stream is one of the reserved characters,
> escape it accordingly so that the HTML renders properly.
> ---
> modules/codec/cc.c | 31 ++++++++++++++++++++++++++++---
> 1 file changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/modules/codec/cc.c b/modules/codec/cc.c
> index 06db964..d094d5a 100644
> --- a/modules/codec/cc.c
> +++ b/modules/codec/cc.c
> @@ -1014,9 +1014,34 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_
> CAT( "<u>" );
> }
>
> - /* */
> - Eia608TextUtf8( utf8, p_char[x] );
> - CAT( utf8 );
> + if( b_html ) {
> + /* Escape XML reserved characters
> + http://www.w3.org/TR/xml/#syntax */
> + switch (p_char[x]) {
> + case '>':
> + CAT( ">" );
> + break;
> + case '<':
> + CAT( "<" );
> + break;
> + case '"':
> + CAT( """ );
> + break;
> + case '\'':
> + CAT( "'" );
> + break;
> + case '&':
> + CAT( "&" );
> + break;
> + default:
> + Eia608TextUtf8( utf8, p_char[x] );
> + CAT( utf8 );
> + break;
> + }
> + } else {
> + Eia608TextUtf8( utf8, p_char[x] );
> + CAT( utf8 );
> + }
>
> /* */
> b_last_underline = b_underline;
>
Shouldn't it use convert_xml_special_chars() (see src/text/strings.c) ?
(This is mostly a question for Rémi since this function and vlc_towc
seems to do a lot of validation that we perhaps don't need here)
More information about the vlc-devel
mailing list