blob: fc10f3880c531292afac24aecb546b1187c7a0f9 [file] [log] [blame]
henrike@webrtc.org47be73b2014-05-13 18:00:261/*
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef _URLENCODE_H_
12#define _URLENCODE_H_
13
14#include <string>
15
henrike@webrtc.orgb2eea5c2014-05-14 18:24:1316namespace rtc {
17
henrike@webrtc.org47be73b2014-05-13 18:00:2618// Decode all encoded characters. Also decode + as space.
19int UrlDecode(const char *source, char *dest);
20
21// Decode all encoded characters.
22int UrlDecodeWithoutEncodingSpaceAsPlus(const char *source, char *dest);
23
24// Encode all characters except alphas, numbers, and -_.!~*'()
25// Also encode space as +.
26int UrlEncode(const char *source, char *dest, unsigned max);
27
28// Encode all characters except alphas, numbers, and -_.!~*'()
29int UrlEncodeWithoutEncodingSpaceAsPlus(const char *source, char *dest,
30 unsigned max);
31
32// Encode only unsafe chars, including \ "^&`<>[]{}
33// Also encode space as %20, instead of +
34int UrlEncodeOnlyUnsafeChars(const char *source, char *dest, unsigned max);
35
36std::string UrlDecodeString(const std::string & encoded);
37std::string UrlDecodeStringWithoutEncodingSpaceAsPlus(
38 const std::string & encoded);
39std::string UrlEncodeString(const std::string & decoded);
40std::string UrlEncodeStringWithoutEncodingSpaceAsPlus(
41 const std::string & decoded);
42std::string UrlEncodeStringForOnlyUnsafeChars(const std::string & decoded);
43
44#endif
45
henrike@webrtc.orgb2eea5c2014-05-14 18:24:1346} // namespace rtc