bitshift bitshift - 4 months ago 16
jQuery Question

What are these hex characters and where could they have come from?

Was helping someone on an app using a jQuery UI datepicker and while testing in different browsers, we noticed a problem in IE 11, at least our version. For some reason, the date string I was feeding to the datepicker for a new javascript date object wasnt playing nice in IE, but worked fine in Chrome.
Finally after over an hour of restarting the debuggers and starring at the screen I started looking a little closer at the string itself. Sure enough, I could hit the arrow keys in some positions and the cursor wouldnt move! Ah Ha! There were some non-printing characters in there somewhere.

I grabbed the Hex editor plugin for Notepad++ and can compare the "un-molested" string and the version with the "extra something" within it.

See screenshots below.

So can anyone comment on what exactly kind of characters these are and where they might have come from?

Here is the "un-molested" version
enter image description here

Here is the "goofy" version. Note that when I look at the "displayed" version in a text editor, all I see is "10/14/2016"
enter image description here

Here is the code Im working with. Its within this function that the variable "DateStart" has the extra characters in it. Note this happens when debugging with IE and Visual Studio 2015. Now when I launch with Google Chrome and use its debugger, I get expected results - the date is fine and the datepicker opens to the correct date.

function ConfigPicker() {

var DateStart = document.getElementById('FromDate').value;
var DateEnd = document.getElementById('ToDate').value;

$("#FromDate").datepicker({ dateFormat: 'mm/dd/yy', defaultDate: new Date(DateStart) });
$("#ToDate").datepicker({ dateFormat: 'mm/dd/yy', defaultDate: new Date(DateEnd) });


You must have copied it from a source that deals with right-to-left text.

The e2 80 8e are 200E LEFT-TO-RIGHT MARK.

You can easily see that by pasting these hex codes to the UTF-8 code units field and click Convert.

See the symbol description at UniView.