I have a .NET forms application that communicates with some CGI Perl scripts on a webserver.
One of the forms application's features is, it sends the text contents of a large "Description" field to the server, for storage in the database. This large string value is sent as a parameter on the request (i.e. text=whatever).
To do this, the first thing we've been doing is running the entire list of parameters on the request through System.Web.HttpUtility.UrlEncode.
Then, we hand off to the method that builds the request. ContentType gets set to "application/x-www-form-urlencoded;charset=UTF-8". We then encode the parameters as UTF-8 right before sending:
byte[] bytes = Encoding.UTF8.GetBytes(parameters);
This has all worked gloriously for years. But recently, the powers that be wanted to know if we could send GERMAN text in that field. So, we've tried that. But it ends up being stored in the database incorrectly. And when my app queries back for it later on, we're seeing gibberish where some of the German language's special characters would be.
The webserver guy is blaming me / my code. Now, I took a look at one particular array of byte[] that we were sending, converted all the decimals to binary...and then looked them up on a unicode table. And everything matches my parameter string just fine.
BUT... in looking further at that unicode table... I saw some funky characters...and I'm thinking the German special characters are probably in there.
So, I'm wondering if I really NEED to be urlencoding my POST data before sending to the server in this situation? I guess I thought urlencoding ALL POST data was required on the server side for this content-type.
Thanks!