URI:
       convert some html entities aswell (  -> " " in particular) - tscrape - twitter scraper
  HTML git clone git://git.codemadness.org/tscrape
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit f3b36a9f13389c1e912db89a5fe6d53b08f2b6e1
   DIR parent 960b93cbd618af0921312d0ffe12f83cca03767d
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sun, 13 Sep 2015 23:20:03 +0200
       
       convert some html entities aswell (&nbsp; -> " " in particular)
       
       Diffstat:
         M tscrape.c                           |      17 +++++++++++++++--
       
       1 file changed, 15 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/tscrape.c b/tscrape.c
       @@ -116,6 +116,19 @@ isclassmatch(const char *classes, const char *clss, size_t len)
                return (p == classes || isspace(p[-1])) && (isspace(p[len]) || !p[len]);
        }
        
       +/* convert XML and some HTML entities */
       +static ssize_t
       +html_entitytostr(const char *s, char *buf, size_t bufsiz)
       +{
       +        ssize_t len;
       +
       +        if ((len = xml_entitytostr(s, buf, bufsiz)) > 0)
       +                return len;
       +        else if (!strcmp(s, "&nbsp;"))
       +                return (ssize_t)strlcpy(buf, " ", bufsiz);
       +        return len;
       +}
       +
        static void
        xmltagend(XMLParser *x, const char *t, size_t tl, int isshort)
        {
       @@ -195,7 +208,7 @@ xmlattrentity(XMLParser *x, const char *t, size_t tl, const char *a, size_t al,
        
                if (!state)
                        return;
       -        if ((len = xml_entitytostr(v, buf, sizeof(buf))) > 0)
       +        if ((len = html_entitytostr(v, buf, sizeof(buf))) > 0)
                        xmlattr(x, t, tl, a, al, buf, (size_t)len);
                else
                        xmlattr(x, t, tl, a, al, v, vl);
       @@ -225,7 +238,7 @@ xmldataentity(XMLParser *x, const char *d, size_t dl)
        
                if (!(state & (Text|Username|Fullname)))
                        return;
       -        if ((len = xml_entitytostr(d, buf, sizeof(buf))) > 0)
       +        if ((len = html_entitytostr(d, buf, sizeof(buf))) > 0)
                        xmldata(x, buf, (size_t)len);
                else
                        xmldata(x, d, dl);