Converting Numeric Values from Query String

Issue #14411309 • Assigned to James M.


Mike C.
Oct 27, 2017
This issue is public.
Found in
  • Microsoft Edge
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

I am trying to pass a date through the query string into a mvc project.
when in the c# code executing my ActionResult for the page load I am pulling the date out and attempting to parse into a datetime. Workds fine in FF and Chrome, but not Edge. When I give up and split the date, (“10/27/2017”), into an array of strings then try to parse this into an int, I get invalid format error when running Edge but works in FF and Chrome.

string[] TempStartDate = StartDate.Split(‘/’);
string[] TempEndDate = EndDate.Split(‘/’);

            int sMonth = int.Parse(TempStartDate[0]); //'Input string was not in a correct format'  however the string being passed in is "10"
            int sDay = int.Parse(TempStartDate[1]);
            int sYear = int.Parse(TempStartDate[2]);

            int eMonth = int.Parse(TempEndDate[0]);
            int eDay = int.Parse(TempEndDate[1]);
            int eYear = int.Parse(TempEndDate[2]);

            PeriodDates[0] = new DateTime(sYear, sMonth, sDay);
            PeriodDates[1] = new DateTime(eYear, eMonth, eDay);


0 attachments

    Comments and activity

    • the url looks like this

    • turns out I have to
      EndDate = Regex.Replace(EndDate, @"[^\u0000-\u007F]+", string.Empty);
      on query string values for edge.

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • Hi Mike,

      I am curious about the source of those date strings.  What you are seeing is the UTF-8 encoding for the LEFT-TO-RIGHT MARK.  E2 80 8E

      I believe this mark is normally used for elements in a web page to specify the direction via UTF-8, which I believe is also deprecated by the HTML <bdi> tag.

      Your regular expression is a work around for this because it is removing all of the unicode characters outside of the lower range which this mark is.  The unicode character is represented as "\u200E".

      Can you give me more information on where this string originated from and also how you are using C# with Edge, I.e. information on your MVC application?

      Once I get more information from you on how you are using this code, I will investigate why the code without the workaround does not work in Edge but does work in other browsers.

      Appreciate the submission,


    • The URL is built here in JS in the view.
      function reloadPage(hostname, period,sDate,eDate) {
      window.location.href = “/ClientBehaviour/PotentialClients?hostname” +
      encodeURI(“=” + hostname + “&period=” + period + “&startdate=” +
      sDate + “&enddate=” + eDate);

      The bits needed are pull out of the query string in the controller here:
      string TargetHostName = Request.QueryString[“hostname”];
      TargetHostName = TargetHostName == null ? “All Hosts” : TargetHostName;
      string TargetPeriod = Request.QueryString[“period”];
      TargetPeriod = TargetPeriod == null ? “yesterday” : TargetPeriod;
      string StartDate = Request.QueryString[“startdate”];
      string EndDate = Request.QueryString[“enddate”];

      Again, all this works with no issue on FF and Chrome, haven’t tested on Opera or Safari.

      Thank you for your help.


    • Microsoft Edge Team

      Changed Assigned To from “Steven K.” to “James M.”

    • Hello,

      Thank you for providing this information about the issue. The format is definitely incorrect for int.parse in C#. Somehow other browsers are removing the URL encoding or not getting it in the first place.

      Clearly Edge is not passing just the date (e.g. 10/25/2017 ); rather, it is passing the date along with non-printing characters (e.g. %E2%80%8E10%E2%80%8E/%E2%80%8E25%E2%80%8E/%E2%80%8E2017 ). Each set before and after each integer appears to be UTF8 encoding for LEFT-TO-RIGHT MARK.

      My question is, what does the URL look like when called in Chrome and Firefox? Does it look like…? hostname=All%20Hosts&period=custom&startdate=10/16/2017&enddate=10/25/2017

      Best Wishes,

      The MS Edge Team

    You need to sign in to your Microsoft account to add a comment.

    Sign in