Choosing tag using query + options encodes tag with html special characters / entities but if typed in manually there is no encoding

I have a tags field in a blueprint as follows:

  label: Tags
  type: tags
  options: query
  query: site.index.pluck('meta_keywords', ',', true)

This successfully generates a list of existing tags as options to choose from. If I manually type in a new tag which contains contains an apostrophe (e.g., “Women’s safety”), this seems to be stored normally and not encoded. So, all good so far.

The problem is that if I select that same saved tag as an option in another page, it actually generates an encoded new tag entry as follows:

Women's safety [note: new saved tag]
Women's safety [note: original saved tag]

There seems to be an inconsistency in the way this is handled. If I just type in “Women’s safety” again, it doesn’t create a new encoded tag, it stores it as per the original saved tag. However, if you choose that existing tag from the list of options instead of typing it out, the apostrophe gets encoded.

So my questions are:

  1. Why is the tag encoded different depending on whether I choose it as an option or type it in?
  2. How can I make it behave consistently for both cases, instead of encoding in one case and not encoding in another?

Many thanks if anyone has the answer to this as it has been puzzling me!

It’s a bug, there is already an issue on GitHub:

Thanks for letting me know Sonja! I was scratching my head on this one and just assumed I had done something wrong, which is usually the case! :rofl:

I’ll just type those tags in manually for now until the issue is resolved, no big deal.