I've been using Java for years and have not run into any need to worry about encoding choices. Now I'm writing a little HTTP server and wonder if I'd better not learn about it. Can anybody point me to a good starting point for reading? Any tips on where I'm really going to need to get it right?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Stan, There are different ways to interpret your question. The contents of POST parameters are URL Encoded. This is a simple process See class java.net.URLEncoder. Sometimes parts of the header are Base64 encoded. If you mean the general encoding of a web request, I have two suggestions. First code a socket program to listen to port 80 (or the port of your choice, if you specify a different port from your browser) and to display what ever contents is sent to it. It will show a lot. Send it get, post, multipart form, etc. requests from your browser and you can see how they are formatted. As far as reading material, I would suggest a book on CGI. The PERL or C code shows a lot about how requests are formatted. Apache/CGI does less "hand holding" than a servlet engine like Tomcat. I would recommend the book I use, but it is a little dated. I have used it for many years, good but there are now better ones out there. Maybe someone can recommend one or you can check the Amazon customer reviews. Not exactly what you are looking for, but I hope it helps.... Don :roll:
Joined: Jan 29, 2003
Sorry that wasn't clear ... are there places that UTF-8 or some other byte-to-character encoding scheme is required? Can I hard code a "universal" setting or can I pick up information from the inbound headers?