added functions to convert between HTTP client and server encoding