New features and browser and OS compatibility

I have a form that takes a list of values, each value is indicated on a separate line textArea. In my servlet, I sign the line that I get from this textArea, based on the new characters of the string "\ r \ n", for example:

String[] partNumberList = originalPartNumberString.split("\r\n");

This is working fine. I get an array of values ​​as expected. I believe this is due to the fact that the browser handles the standardization of the method of sending new lines to the server, regardless of which OS / browser submits the form data ( see this post ), I tested it in IE, Firefox, Chrome ... all seems to work fine with this, and I feel pretty confident about it.

After receiving the server-side values, I then use these values ​​for some search queries, etc., then I return them back to textArea for a response. To do this, I write it the same way I get it ... I just create a new line and separate each value with "\ r \ n". Then I set the value of textArea to this line.

StringBuffer invalidReturnPartList = new StringBuffer("");

for (int i = 0; i < requestedPartList.length; i++)
{
    invalidReturnPartList.append(requestedPartList[i]);
    invalidReturnPartList.append("\r\n");
}

return invalidReturnPartList.toString();

This also checks OK for me in all browsers I tried. However, I'm just nervous about whether I cover all of my databases here ... if someone is running on a Mac, will "\ r \ n" translate correctly into my browser? What about Linux? I would have thought that everything would be handled in a browser, but I'm just not sure here ... so my question is: does this look like you, or did I miss something?

+3
2

.

textArea , "application/x-www-form-urlencoded", "CR LF" HTML (. http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1).

, , .

, (, JavaScript), , ... . , , , , / . , , "\ r\n", "\ r" "\n".

+3

HTTP, , :

HTTP/1.1 CR LF , (. 19.3
). - , 3.7.

. , , , text/plain, :

3.7.1

- .
-, HTTP , "", , .

"" CRLF . HTTP CR LF, , . HTTP- CRLF, CR LF , HTTP.

, UNIX.

( http://www.ietf.org/rfc/rfc2616.txt)

+2

Source: https://habr.com/ru/post/1709693/


All Articles