I wanted to post result of JavaScript expression JSON.stringify(String.fromCodePoint(128514).split(''))

It's impossible - when posted as comment it cause page to reload, and when posted in question/answer jQuery throws Malformed URI error and cause endless spinning of "posting answer" (nothing is even sent to server).

  • "["�","�"]" - "["�","�"]" – Oded Feb 5 '16 at 12:01
  • Still no repro... could this be something in your network blocking that content? – Oded Feb 5 '16 at 12:01
  • I can reproduce it every time - Firefox 43 on Win 10. – Ginden Feb 5 '16 at 12:02
  • And if you use another browser to test this? – Patrick Hofman Feb 5 '16 at 12:11
  • 4
    For some reason, it looks like FF is trying to do a get request - with the comment details appended as a parameter to the query string. – Oded Feb 5 '16 at 12:16
  • 2
    Seems to work on other browsers. So it's FF specific bug. – Ginden Feb 5 '16 at 12:26
  • you should totally drop that and try jQuery its really great and does all thigns. – Adam Davis Feb 5 '16 at 13:07

It's impossible

It actually is! Splitting up a UTF-16 surrogate sequence gives you two strings each with a single surrogate in. JavaScript can cope with this because its strings are internally no more than sequences of UTF-16 code units, but they're not valid in terms of Unicode code point strings and they cannot be represented in UTF-8.

Like most web apps StackOverflow's input/output is all in UTF-8, so there isn't actually any way to get the data into the system.

I suspect the thing with Getting the long URL is because trying to encode the data into UTF-8 causes a JavaScript error, which stops the form submit handler from preventDefaulting the form, so the form submits as a native HTTP GET form.

Ideally SO perhaps could detect the bad string and complain earlier, and probably the add-comment form should be POST and its submit button should be type="button" so it doesn't accidentally work when JS is unavailable/broken.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .