Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15667

Re: String Processing in JavaScript

From Mike Winter <usenet@michael-winter.me.invalid>
Newsgroups comp.lang.javascript
Subject Re: String Processing in JavaScript
References <rgf248la5ap1dusauc9ek39jasff47mht4@4ax.com> <6os248lttein62omugahl5avvlpb18o8o2@4ax.com> <aadeqvFtm3U1@mid.individual.net> <0308485hn1uq91aj3vbpq0f8rsc21sa26r@4ax.com>
Message-ID <Tk81s.444803$UL.302485@fx19.am4> (permalink)
Organization virginmedia.com
Date 2012-09-03 21:23 +0100

Show all headers | View raw


On 03/09/2012 02:04, Gene Wirchenko wrote:
> On Fri, 31 Aug 2012 21:47:40 -0600, "Mel Smith"
> <med_cutout_syntel@aol.com> wrote:
>
>> Jim said:
>>> Perhaps String.split() ?
>
>>     Agree 1000% with Jim !
>>
>>     I send 2000+ chars strings to/from my server, and my server .exe builds
>> a 'splittable' string back to the browser.
>>
>>     Your structure is ideal for a 'double' split. The 1st split would bust
>> up the string at the 'newline' char creating an array of n-rows of chars
>
>       Assuming an encodeURIComponent() result can never contain
> newline.  I have not come across a precise definition of exactly what
> it does.

The formal definition is in section 15.1.3 [1] of ECMA-262 (5.1/June 
2011 Edition, but it seems to me to be functionally identical to the 
third edition).

Essentially, if the string argument contains any characters other than 
the following from the ASCII character set, those characters will be 
percent-encoded in the returned string: letters and digits, hyphen-minus 
(-), underscore (_), full-stop/period/dot (.), exclamation mark (!), 
tilde (~), asterisk (*), apostrophe ('), and parentheses ("(", ")"). 
These are the characters from the "unreserved" and "mark" grammar 
productions in RFC 2396 - URI Generic Syntax [2] (although this RFC has 
been superceded).

So yes, you will not encounter a CR or LF (or /any/ control character 
for that matter) after successfully returning from the 
encodeURIComponent function.

I hope that helps,
Mike

[1] <http://ecma-international.org/ecma-262/5.1/#sec-15.1.3>
[2] <http://tools.ietf.org/html/rfc2396#page-27>

-- 
Mike Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-08-31 15:56 -0700
  Re: String Processing in JavaScript Mike Winter <usenet@michael-winter.me.invalid> - 2012-09-01 02:30 +0100
    Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-02 17:56 -0700
  Re: String Processing in JavaScript Jim T. <x@y.z> - 2012-08-31 22:30 -0400
    Re: String Processing in JavaScript "Mel Smith" <med_cutout_syntel@aol.com> - 2012-08-31 21:47 -0600
      Re: String Processing in JavaScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-01 08:51 +0000
        Re: String Processing in JavaScript "Mel Smith" <med_cutout_syntel@aol.com> - 2012-09-01 08:38 -0600
      Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-02 18:04 -0700
        Re: String Processing in JavaScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-03 16:30 +0000
        Re: String Processing in JavaScript Mike Winter <usenet@michael-winter.me.invalid> - 2012-09-03 21:23 +0100
          Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 14:26 -0700
  Re: String Processing in JavaScript Stefan Weiss <krewecherl@gmail.com> - 2012-09-03 19:29 +0200
    Re: String Processing in JavaScript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-03 21:45 +0200
    Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 14:27 -0700
      Re: String Processing in JavaScript Stefan Weiss <krewecherl@gmail.com> - 2012-09-04 00:48 +0200
        Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 17:20 -0700
        Re: String Processing in JavaScript Tim Streater <timstreater@greenbee.net> - 2012-09-04 10:06 +0100
          Re: String Processing in JavaScript Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-09-04 20:02 +1000
          Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-04 08:47 -0700

csiph-web