Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <4919648.gLsDIqzOUs@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 25 Aug 2012 12:02:36 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 37 NNTP-Posting-Date: 25 Aug 2012 12:02:38 CEST NNTP-Posting-Host: d59c315c.newsspool2.arcor-online.net X-Trace: DXC=GSRDB6MaLgP1`E>oC;JXEZA9EHlD;3YcR4Fo<]lROoRQ8kF]j Gene Wirchenko wrote: >> I have found that using the GET style of >> oRequest.open("POST",Url+"?"+DataToSend,true); >> oRequest.send(); >> does work. At least, it appears to. >> >> […] >> 2) What should I do for escaping of data? Going to the server, any >> line breaks get eaten somewhere so I use escape() at browser and >> unescape() at server. Going from server to browser, line break are >> not eaten. Does this mean that I do not have to escape()/unescape() >> on the trip back? >> >> Are escape() and unescape() the correct functions to use? > > For POST requests escaping on the client side should not be necessary. Incorrect. The payload of the POST request (the message body) needs to be URI-percent-encoded, see RFC 2616. > For GET requests encodeURI() resp. encodeURIComponent seem to be more > appropriate. encodeURIComponent() is the function to be used for percent-encoding of each parameter name and value regardless of the request method. The proprietary escape() and unescape() functions should not be used as they are not Unicode-safe. PointedEars -- > If you get a bunch of authors […] that state the same "best practices" > in any programming language, then you can bet who is wrong or right... Not with javascript. Nonsense propagates like wildfire in this field. -- Richard Cornford, comp.lang.javascript, 2011-11-14