1

I've made an extension for google Chrome, it's a Bot for the Supreme Shop. The Bot worked nearly one year. But now Supreme changed their Product names. Example: before "Supreme®/Hanes® Tagless Tees (3 Pack)" and now they put randomly some &#65279 (Zero Width No-Break Space) in the Name. I've tried to delete this with ** product_color = product_color.replace(/&#,65279;/g, '');** But this is not really working. Does anybody has an idea..

ps: there's no colon in my code. But else it would like this in the post //

thanks alot

Kinay
  • 37
  • 2
  • 7
  • 2
    You can use Unicode in Regex with `\uFEFF`. I.e. `product_color = product_color.replace(/\uFEFF/g,"");`. – Iván Nokonoko Feb 26 '18 at 13:05
  • @IvánNokonoko could you expalin a bit more? I'm using the product name to compare with my keywords and if they fit the bot takes it and if there are some unicode symbols they dont match – Kinay Feb 26 '18 at 13:07
  • @IvánNokonoko: My mistake, it isn't *(an invalid Unicode escape sequence, as my deleted comment said; I thought it would require a surrogate pair, but it doesn't)*. You should post that as an answer. – T.J. Crowder Feb 26 '18 at 13:09
  • @YanikEmmenegger: `` is just a numeric character reference for character U+FEFF. When the browser parses the HTML, it turns that into the relevant character. In JavaScript, you can write that same character as `\uFEFF`, and so you can replace it as shown in his comment above. – T.J. Crowder Feb 26 '18 at 13:11
  • Thanks it works @IvánNokonoko – Kinay Feb 26 '18 at 13:23
  • Thanks it works @T.J.Crowder – Kinay Feb 26 '18 at 13:23

0 Answers0