[vlc-commits] strings: add missing support for hexadecimal XML chracter encoding

Rémi Denis-Courmont git at videolan.org
Sun Nov 9 19:11:38 CET 2014


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov  9 20:08:35 2014 +0200| [8fa73247c32e9521f867443d5ae0eba85e1afcbb] | committer: Rémi Denis-Courmont

strings: add missing support for hexadecimal XML chracter encoding

(cherry picked from commit 3eee999c45a150aede6233e7bbd7064949c84012)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=8fa73247c32e9521f867443d5ae0eba85e1afcbb
---

 src/text/strings.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/text/strings.c b/src/text/strings.c
index 55738a7..933dd9c 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -202,9 +202,15 @@ void resolve_xml_special_chars( char *psz_value )
         if( *psz_value == '&' )
         {
             if( psz_value[1] == '#' )
-            {   /* &#xxx; Unicode code point */
+            {   /* &#DDD; or &#xHHHH; Unicode code point */
                 char *psz_end;
-                unsigned long cp = strtoul( psz_value+2, &psz_end, 10 );
+                unsigned long cp;
+
+                if( psz_value[2] == 'x' ) /* The x must be lower-case. */
+                    cp = strtoul( psz_value + 3, &psz_end, 16 );
+                else
+                    cp = strtoul( psz_value + 2, &psz_end, 10 );
+
                 if( *psz_end == ';' )
                 {
                     psz_value = psz_end + 1;



More information about the vlc-commits mailing list