Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] unexpected 'escape' is undefined

Expand Messages
  • Douglas Crockford
    Don t use escape. Use encodeURI or encodeURIComponent instead.
    Message 1 of 5 , Dec 7, 2008
    • 0 Attachment
      Don't use escape. Use encodeURI or encodeURIComponent instead.

      michael.gollmick wrote:
      > Hi,
      >
      > while checking a script and reducing a lot of flaws in it with the
      > webjslint, the following message came up:
      >
      > Problem at line 130 character 34: 'escape' is undefined.
      >
      > var curCookie = name + "=" + escape(value) +
      >
      > while I had checked the option "assume a browser" and from what I know
      > escape and unescape are native functions in at least a browser, that
      > message came anyway.
      >
      > Does anyone have a hint to avoid that message (which comes up for
      > unescape as well)?
      >
      > thanks in advance :-)
      >
      > --
      > Michael
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
    • crlender
      ... But what if the server can t handle UTF-8 encoded characters? Many legacy applications are stuck with escape/unescape. - Conrad
      Message 2 of 5 , Dec 7, 2008
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
        >
        > Don't use escape. Use encodeURI or encodeURIComponent instead.

        But what if the server can't handle UTF-8 encoded characters? Many
        legacy applications are stuck with escape/unescape.

        - Conrad
      • Douglas Crockford
        ... /*global escape */
        Message 3 of 5 , Dec 7, 2008
        • 0 Attachment
          crlender wrote:
          > --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
          >> Don't use escape. Use encodeURI or encodeURIComponent instead.
          >
          > But what if the server can't handle UTF-8 encoded characters? Many
          > legacy applications are stuck with escape/unescape.

          /*global escape */
        • michael.gollmick
          ... absolutely - that was my solution too ;-) I just thought every browser implements that extension to the ECMA Script and thus expected it to disappear with
          Message 4 of 5 , Dec 7, 2008
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
            >
            > crlender wrote:
            > > --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@> wrote:
            > >> Don't use escape. Use encodeURI or encodeURIComponent instead.
            > >
            > > But what if the server can't handle UTF-8 encoded characters? Many
            > > legacy applications are stuck with escape/unescape.
            >
            > /*global escape */
            >
            absolutely - that was my solution too ;-) I just thought every browser
            implements that extension to the ECMA Script and thus expected it to
            disappear with checking the "assume a browser" option. But I was
            probably wrong.

            --
            Michael
          Your message has been successfully submitted and would be delivered to recipients shortly.