edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev]  bad byte in NASA's vendor.js
Date: Fri, 30 Dec 2016 14:58:52 -0500	[thread overview]
Message-ID: <20161130145852.eklhad@comcast.net> (raw)
In-Reply-To: <871swpw8p2.fsf@the-brannons.com>

> I think the heart of the matter is that JS_EvaluateScript cannot cope
> with non-ASCII things, even if encoded in UTF8.

Yes it can, as shown in my previous example.
utf8 chars can be in strings, or even regular expressions.
This works.

var x = "a b";
alert(x.replace(/ /, "-"));

It prints out a-b.

It doesn't seem to handle breakspace as whitespace however, and yet it should, and apparently does in other browsers.
I don't think converting everything to unicode would change anything.
It would still accept my code fragment above, and likely barf on breakspace elsewhere.

As a really imperfect solution, I'm thinking about changing every breakspace to space, unless:
it is in a line less 200 characters &&
the line does not start with // &&
it is not part of a string wholly contained in this line using a rather simple " " criterion.

I'm trying to avoid writing a js scanner, which is really not a trivial thing,
beyond what lex can handle, mostly because of those cursed regular expressions that aren't even quoted,
just appear free, and we're suppose to recognize them as such,
even though almost any character can appear between the slashes.
I know about this nightmare because I parsed and ran my own javascript in edbrowse version 2.
It's really best left to someone else!
But then again, that someone else isn't handling breakspace properly.

Karl Dahlke

  reply	other threads:[~2016-12-30 19:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-30  1:30 Kevin Carhart
2016-12-30  2:11 ` Chris Brannon
2016-12-30  3:24   ` Karl Dahlke
2016-12-30 18:52     ` Chris Brannon
2016-12-30 19:58       ` Karl Dahlke [this message]
2016-12-30 20:07         ` Chris Brannon
2016-12-30 23:13           ` Karl Dahlke
2016-12-31  5:28             ` Kevin Carhart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161130145852.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).