vlc | branch: master | Devin Heitmueller <[email protected]> | Thu 
Dec 27 01:08:17 2012 -0500| [4536d80970edb271210eace32112e2a465029747] | 
committer: Rafaël Carré

Fix rendering of HTML reserved characters

If the character in the EIA-608 stream is one of the reserved characters,
escape it accordingly so that the HTML renders properly.

Signed-off-by: Rafaël Carré <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4536d80970edb271210eace32112e2a465029747
---

 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 eeb8793..f20ae20 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -996,9 +996,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( "&gt;" );
+                break;
+            case '<':
+                CAT( "&lt;" );
+                break;
+            case '"':
+                CAT( "&quot;" );
+                break;
+            case '\'':
+                CAT( "&apos;" );
+                break;
+            case '&':
+                CAT( "&amp;" );
+                break;
+            default:
+                Eia608TextUtf8( utf8, p_char[x] );
+                CAT( utf8 );
+                break;
+            }
+        } else {
+            Eia608TextUtf8( utf8, p_char[x] );
+            CAT( utf8 );
+        }
 
         /* */
         b_last_underline = b_underline;

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to