Re: string length and newlines



Steve Swift wrote:

Bart Van der Donck wrote:

Checking on a separate CR or LF is not necessary; CR+LF should be
enough. Newlines in a TEXTAREA which are not transmitted as '\r\n',
are in violation of RFC.

Bart, Thank you for confirming what I'd noticed in practice.
I do, however, have a few examples where single x'0A' characters have
found their way into my data files, and since this is the linend
sequence on my linux server, it caused problems.

I checked my code 'till I was blue in the face, and never found any way
this could happen unless a browser had submitted an x'0A' as a linend
from a TEXTAREA control. Of course, I have no control over what strange
browsers people might be using, so I took the pragmatic approach of
translating both x'0A' and x'0D' to my x'0102' "line-end" sequence.
There have been no re-occurrences of the problem.

I'm thinking of 4 possibilities:

- manual crafting of the URL (?data=one%0Atwo)
- an incorrect browser violating RFC
- an error in the regular expression or its execution order; in your
case it's necessary to first do:
'\r\n' -> '\x01\x02'
before
'\r' -> '\x01\x02' and '\n' -> '\x01\x02'
- incorrect URL parsing of the server script like ?data=one%250Atwo
or something with percent-encoding under UTF-8 (headache warning)

I would go for your pragmatic approach as well.

--
Bart
.



Relevant Pages

  • Re: string length and newlines
    ... Newlines in a TEXTAREA which are not transmitted as '\r\n', ... are in violation of RFC. ...
    (comp.lang.javascript)
  • Re: Question on device driver ? [OT]
    ... Richard Heathfield wrote: ... What part of RFC 1855 is it in "clear" violation of? ... My daughter downloads Japanese films with that e-mule ...
    (comp.lang.c)
  • Re: Question on device driver ? [OT]
    ... Richard Heathfield wrote: ... Richard, you said, and I quote, "this is in clear violation of RFC 1855". ... poster around, nor the most frequent. ...
    (comp.lang.c)
  • Re: Question on device driver ? [OT]
    ... Richard Heathfield wrote: ... Richard, you said, and I quote, "this is in clear violation of RFC 1855". ... regular contributor to this group who does not observe the four-line sig ...
    (comp.lang.c)
  • Re: Thinking about getting a newsreader to block D. Spencer Hines
    ... RFC or not. ... As far as I can see, it's not really a violation of a mandatory ... have to be added to break a long URI across lines. ... Once that have line-breaks aren't clickable from XanaNews, ...
    (alt.usage.english)