0

I noticed that in IE11 and Edge (but not Chrome), Extjs6 is encoding my jsonData in a strange way. If I do a POST with the string '‎8‎/‎17‎/‎2016 13:07:00' as one of the jsonData parameters, it will pass '\u200e8\u200e/\u200e17\u200e/\u200e2016 13:07:00' in the request body.

I also noticed that if I enter Ext.JSON.encode('‎8‎/‎17‎/‎2016 13:07:00') into the console that it converts the string in the same way. I suspect that Extjs is using IE's encoder (since Chrome works), so it is really an IE issue and not an Extjs issue. Can you please explain why this happens and if there is a format that will not convert improperly for my POST?

Web_Designer
  • 72,308
  • 93
  • 206
  • 262
Jon
  • 33
  • 2
  • 7
  • You can use Ext.encode() also for encoding instead of Ext.JSON.encode(). – Tejas Apr 07 '17 at 07:00
  • I found the culprit, but I am not sure how to fix it. Ext.encode(new Date('2016-08-17T06:37:00').toLocaleDateString()) will result in ""\u200e8\u200e/\u200e17\u200e/\u200e2016"". How do I encode this without the special characters? – Jon Apr 07 '17 at 13:47
  • Sorry I didnt get this.What result you expect for Ext.encode(new Date('2016-08-17T06:37:00').toLocaleDateString()) ? – Tejas Apr 07 '17 at 13:59

2 Answers2

0

There is a simple mistake here as far as i think.

Do

Ext.JSON.encode("8/17/2016 13:07:00")

instead of

Ext.JSON.encode('8/17/2016 13:07:00')

then it will take it as the string that you want.

And ya one more thing, this issue will be in latest chrome version also.

Harshit Shah
  • 266
  • 2
  • 7
  • Thanks for this tip. This still leaves me with the underlying problem of how to get the Ext.Ajax.request POST to keep the data in a string format instead of converting it. – Jon Apr 07 '17 at 12:41
0

Once I discovered the issue is with toLocaleDateString(), then I found this post which answered the question: ToLocaleDateString() changes in IE11

Instead of Ext.encode(new Date('2016-08-17T06:37:00').toLocaleDateString()), use Ext.encode(new Date('2016-08-17T06:37:00').toLocaleDateString().replace(/\u200E/g, ''))

Community
  • 1
  • 1
Jon
  • 33
  • 2
  • 7