I'm not at all sure whether my current method of calculating the content-length is correct. What are the implications of using string.length() to calculate the content-length. Does setting the charset to utf-8 even mean anything when using node.js?
payload = JSON.stringify( payload );
response.header( 'content-type', application/json; charset=utf-8 );
response.header( 'content-length', payload.length );
response.end( payload );