public static void parse( String queryString,
			      String encoding,
			      Map<String,String> destination ) 
	throws NullPointerException,
	       UnsupportedEncodingException {


	if( queryString == null )
	    throw new NullPointerException( "Cannot parse null-query." );
	
	
	String[] split = queryString.split( "\\&" );
	
	for( int i = 0; i < split.length; i++ ) {

	    
	    // Split is empty? 
	    // (should not happen in well-formed query strings, but this might be more secure)
	    if( (split[i] = split[i].trim()).length() == 0 )
		continue;


	    String key = null;
	    String value = null;
	    int index = split[i].indexOf("=");

	    // Split consists of '=' only?
	    if( split[i].length() == 1 )
		continue;


	    if( index == 0 ) {

		// Key is empty
		key   = "";
		value = split[i].substring( 1, split[i].length() ).trim();

	    } else if( index == -1 ) {

		// No '=' at all (key only)
		key   = split[i];
		value = "";

	    } else if( index+1 >= split[i].length() ) {

		// value is empty
		key   = split[i].substring( 0, split[i].length()-1 ).trim();
		value = "";

	    } else {

		// Both are present
		key   = split[i].substring( 0, index ).trim();
		value = split[i].substring( index+1, split[i].length() ).trim();

	    }

	    // Decode both
	    // (might throw UnsupportedEncodingException)
	    key    = URLDecoder.decode( key, encoding );
	    value  = URLDecoder.decode( value, encoding );


	    // Store in map
	    destination.put( key, value );
	}

    }