Content-Length calculation wrong when posting UTF-8 content
The current project is driving me crazy ...
I carefully followed the "Unicode Best-Practice" guide (https://support.smartbear.com/readyapi/docs/testing/best-practices/unicode-support.html) which cured my problem when reading(!) some(!) UTF-8 encoded characters within a RESPONSE.
The
-Dfile.encoding=UTF8
in the *.vmoptions did the trick. Would make a good default setting...
I even got the JSON POST reply formatted as UTF-8 correctly by specifically specifying the UTF-8 encoding in the REST properties.
But I can't get the "Content-Length" header correct. It always is a few counts short. Either it's because the data indeed contains UTF-8 multy-byte characters or it is counting line-breaks wrong. It might count "characters" instead of "bytes". My back-end complains with a 500 error.
Shouldn't the above setting care for the Content-Length too?
If I watch the communication in Fiddler, copy over the request content to notepad++ to see the actual length, manually change the Content-Length and re-issue the post, my back-end finally does accept the POST.
So what might I still missing?