Technical approach
XMLHTTPRequest/AJAX Requests are ALWAYS done by ANY web browser with UTF-8 charset encoding.
On Solidgone David Gilbert wrote:
(Read the full article: »JavaScript Ajax Request is always UTF-8«)
»In principle you'll either be using the XMLHttpRequest object directly with JavaScript, or indirectly through some library, like jQuery. Either way you'll see options allowing you to specify which character set should be used. What is not clear is that you are not able to specify which character set should be used for the Request portion of the transaction. Despite what the documentation, and the configuration options might lead you to believe, the Request character set is fixed to UTF-8. Normal forms are sent using the encoding of the parent page, Ajax submitted forms will always be sent as UTF-8...«
There is not necessarily a one-to-one relationship between transferred bytes and characters. For example, the character length of "Gøød idea!" is 10 but the byte length is 12 in UTF-8.* German character length of »für 1,- €« is 9, byte length is also 12.
In both above cases content-length** = bytes being transferred is 12.
The main goal of jSEND is to introduce a solution which squeezes content-length by clever data encoding - 847enc, the magic - so that only 1-byte UTF-8 chars need to be transmitted. This only can be achieved in combination with prior data compression (LZW, Huffmann encoding is also good but has in my view cons/performance issues with large data and recursion in javascript).
To be continued asap...
