• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Encoding for Newbies

 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic