This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoding for Newbies

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic