Ok. I've been told by at least one really helpful individual who believes that its easy to decode and parse a GET/POST request header from within CherryPy. I've been here: http://www.cherrypy.org/wiki/BuiltinTools#tools.decode but it doesn't give you an exampl开发者_JAVA技巧e. Can someone direct me to a more helpful example?
I guess there are two parts embedded to your question:
1) How to get the headers
cherrypy.request.headers is a dict, you can extract information like any other dictionary
2) How to use the decoding / encoding support provided in tools.decode
@tools.decode(encoding='ISO-88510-1')
def decodingFunction(self, data):
return "%s" % (data, )
This will allow you to decode a string using above encoding set. The string returned is unicode. Pass the information you extract from the dictionary to your decoding and encoding functions and you should be able to use this.
精彩评论