de.infinityloop.util
Class CustomURLEncoder

java.lang.Object
  extended by de.infinityloop.util.CustomURLEncoder

public class CustomURLEncoder
extends java.lang.Object

The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format.

To convert a String, each character is examined in turn:


Field Summary
static int kPlatformMac
           
static int kPlatformUnix
           
static int kPlatformWindows
           
 
Method Summary
static java.lang.String decode(java.lang.String s)
          Translates a string from x-www-form-urlencoded format to a UTF-8 Java string. 2005-10-14: Added new heuristics: What to do when the string contains high-ASCII-characters?
static java.lang.String encode(java.lang.String s)
          Translates a string into x-www-form-urlencoded format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kPlatformWindows

public static final int kPlatformWindows
See Also:
Constant Field Values

kPlatformMac

public static final int kPlatformMac
See Also:
Constant Field Values

kPlatformUnix

public static final int kPlatformUnix
See Also:
Constant Field Values
Method Detail

encode

public static java.lang.String encode(java.lang.String s)
Translates a string into x-www-form-urlencoded format.

Parameters:
s - String to be translated.
Returns:
the translated String.

decode

public static java.lang.String decode(java.lang.String s)
Translates a string from x-www-form-urlencoded format to a UTF-8 Java string. 2005-10-14: Added new heuristics: What to do when the string contains high-ASCII-characters? E.g. Word writes "URL"s that have spaces quoted correctly (%20), but have umlauts simply written 1:1 as high-ASCII characters. What we need to do is determine which encoding we should use for that hi-ASCII characters to convert it into the appropriate Unicode character. For now, we assume that any hi-ASCII-characters are UTF-8 compatible, i.e. part of CP1252

Parameters:
s - String to be decoded.
Returns:
the translated String.