Home > Back-end >  Why this script doesn't recognize the ► symbol and is it possible to solve it?
Why this script doesn't recognize the ► symbol and is it possible to solve it?

Time:12-06

I use this code to display the Top Commentators in my blog: http://yabtb.blogspot.com/2012/05/top-commenters-gadget-with-avatars.html and we have the option to exclude some names.

The problem I'm facing now and I have been searching for a solution or a at least an answer or clue on how to solve it, is that some name with wierd/special symbols are not recognized by the script to be excluded.

Here is the part where we insert the names and an example of one (the last one), that I can't exclude:

var excludeUsers = ["Anonymous","Anónimo","Unknown","joão amarelado","► JUCA ELE ◄"];     // exclude these usernames

All names I've placed so far have worked great and unfortunatly, I don't think asking the code creator for help is an option anymore so my last hope is if someone here more savvy at coding can help.

I've tried to convert the name, escape the symbols and have tried some jquery scripts to see if the name is recognized with .text() or html() and it is...

I'm thinking that can be something on the part that read the feed:

var authorUri = "";
    if(entry.author[0].uri && entry.author[0].uri.$t != "")
      authorUri = entry.author[0].uri.$t;

    if(excludeMe && authorUri != "" && authorUri == urlMyProfile)
      continue;
    var authorName = entry.author[0].name.$t;
    if(excludeUsers.indexOf(authorName) != -1)
      continue;

    var hash=entry.author[0].name.$t   "-"   authorUri;
    if(topcommenters[hash])
      topcommenters[hash].count  ;
    else {
      var commenter = new Object();
      commenter.author = entry.author[0];
      commenter.count = 1;
      topcommenters[hash] = commenter;
    }

But my knowledge is not that much to see what can be the issue.

Thank you for any help possible.

CodePudding user response:

You mentioned you tried escaping the characters, but what syntax did you use?

I would say to do it like this:

var excludeUsers = ["Anonymous","Anónimo","Unknown","joão amarelado","\u25ba JUCA ELE \u25c4"];
  • Related