Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesper Skjønnemand 66 posts 441 karma points c-trib
    Jan 03, 2023 @ 08:42
    Jesper Skjønnemand
    0

    issue with special characters in tags

    I experience issues with property type tags when editors use the & character in tags, e.g. "Research & Development".

    My setup is this:

    First, I check the URL for a topic value.

    var topic = string.Empty;
    topic = string.IsNullOrEmpty(Request["t"])
      ? string.Empty
      : Request["t"];
    

    I then transform the value to lowercase.

    var topicLow = topic.ToLower();
    

    Finally I look for the lowercase topic value in an array named "everything".

    var myResult = everything.Where( x => x.Value<string[]>("topicTags").Select(s => s.ToLowerInvariant()).ToArray().Contains(@topicLow) );
    

    This works just fine in most cases, just not when the topic tag contains a & character.

    Possible reasons for this issue and suggestions for solutions will be much appreciated.

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Jan 03, 2023 @ 13:03
    Huw Reddick
    100

    It is most likely being encoded

  • Jesper Skjønnemand 66 posts 441 karma points c-trib
    Jan 17, 2023 @ 07:55
    Jesper Skjønnemand
    0

    yup, encoding/decoding it was

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies