[object Object]

← back to Rentv

pr/adapters: stripTags now decodes numeric character references (decimal + hex) + &hellip;/&reg;/&copy;/&trade;. It only decoded a handful of named entities, so scraped text (RSS titles, website extraction, press contacts across every adapter) leaked literals like 'Smith &#38; Co', 'Q3 &hellip;', 'Caf&#233;', 'A&#x26;B'. Generic num-ref decode with a control-char guard (never emit <32/127 from malformed feeds). Verified new decodes + existing entities unregressed + control chars neutralized

8d77a6f0278d7e63b60ee85649cf917e00b8889d · 2026-08-06 01:24:33 -0700 · Steve

Files touched

Diff

commit 8d77a6f0278d7e63b60ee85649cf917e00b8889d
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Aug 6 01:24:33 2026 -0700

    pr/adapters: stripTags now decodes numeric character references (decimal + hex) + &hellip;/&reg;/&copy;/&trade;. It only decoded a handful of named entities, so scraped text (RSS titles, website extraction, press contacts across every adapter) leaked literals like 'Smith &#38; Co', 'Q3 &hellip;', 'Caf&#233;', 'A&#x26;B'. Generic num-ref decode with a control-char guard (never emit <32/127 from malformed feeds). Verified new decodes + existing entities unregressed + control chars neutralized
---
 src/pr/adapters/index.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pr/adapters/index.js b/src/pr/adapters/index.js
index fd1adc24..fe4ba47b 100644
--- a/src/pr/adapters/index.js
+++ b/src/pr/adapters/index.js
@@ -83,11 +83,17 @@ function report(base) {
 }
 
 function stripTags(html) {
+  // Decode a numeric character reference to its char, but never emit control chars (malformed feeds).
+  const num = (n) => { try { return (n >= 32 && n !== 127) ? String.fromCodePoint(n) : ' '; } catch { return ' '; } };
   return String(html || '')
     .replace(/<script[\s\S]*?<\/script>/gi, ' ').replace(/<style[\s\S]*?<\/style>/gi, ' ')
     .replace(/<[^>]+>/g, ' ').replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&')
     .replace(/&#0?39;|&rsquo;|&lsquo;|&#8217;/g, "'").replace(/&quot;|&ldquo;|&rdquo;/g, '"')
     .replace(/&ndash;|&#8211;/g, '\u2013').replace(/&mdash;|&#8212;/g, '\u2014')
+    .replace(/&hellip;/g, '\u2026').replace(/&reg;/g, '\u00ae').replace(/&copy;/g, '\u00a9').replace(/&trade;/g, '\u2122')
+    // numeric character references (decimal + hex) \u2014 covers &#38; &#233; &#8230; &#x26; that named-only decoding misses
+    .replace(/&#(\d{1,7});/g, (_, n) => num(+n))
+    .replace(/&#x([0-9a-f]{1,6});/gi, (_, h) => num(parseInt(h, 16)))
     .replace(/\s+/g, ' ').trim();
 }
 

← 88150cf6 auto-save: 2026-08-06T01:17:20 (7 files) — data/deals-regist  ·  back to Rentv  ·  pr/adapters: Cody gate — decode &amp; LAST in stripTags (aft e246fdef →