Line breaks in <textarea> input forms submission: Same for all browsers?
Are line breaks sent the same way by all (major) browsers / operating systems?
Or do Win开发者_C百科dows clients send line breaks as \r\n
and *nix send them as \n
?
Unfortunately, they're different for different OSs.
At least HTML tries to compensate for that when preprocessing HTML input:
U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. Any CR characters that are followed by LF characters must be removed, and any CR characters not followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are represented by LF characters, and there are never any CR characters in the input to the tokenization stage.
http://dev.w3.org/html5/spec/parsing.html#preprocessing-the-input-stream
精彩评论