Encode the uris composing either the keys or the values of the array in

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param  array uris
@param  int encodeMode
@param  boolean dotMode
@param  boolean uniqueMode
@return array
518177
public static function encodeArray($uris, $encodeMode = self::ENCODE_ARRAY_ALL, $dotMode = true, $uniqueMode = false)
    {
        $returnValue = [];

        if (is_array($uris)) {
            foreach ($uris as $key => $value) {
                if ($encodeMode == self::ENCODE_ARRAY_KEYS || $encodeMode == self::ENCODE_ARRAY_ALL) {
                    $key = self::encode($key, $dotMode);
                }
                if ($encodeMode == self::ENCODE_ARRAY_VALUES || $encodeMode == self::ENCODE_ARRAY_ALL) {
                    $value = self::encode($value, $dotMode);
                }
                $returnValue[$key] = $value;
            }
        }

        if ($uniqueMode) {
            $returnValue = array_unique($returnValue);
        }

        return $returnValue;
    }
1352618
public function composeUri($params)
    {
        $ret   = '';
        $first = true;

        foreach ($params as $param => $values) {
            if (!$first) {
                $ret .= $this->seperators['param'];
            }
            $first    = false;
            $internal = $param;
            if ($external = $this->translateKeyOutput($param)) {
                $param = $external;
            }
            $ret .= $param . $this->seperators['key_value'];
            $firstValue = true;
            foreach ($values as $value) {
                if ($external = $this->translateValueOutput($internal, $value)) {
                    $value = $external;
                }
                if (!$firstValue) {
                    $ret .= $this->seperators['value'];
                } else {
                    $firstValue = false;
                }
                $ret .= urlencode($value);
            }
        }

        return $ret;
    }
1194329
@Override
	public String encodeAsString() {
		if(message.size == 0) return "";

		return new String(Base64Coder.encode(message.array, message.size));
	}
1212933
public function encodeModeStructure()
    {
        try {
            $bs =  new QRbitstream();

            $bs->appendNum(4, 0x03);
            $bs->appendNum(4, ord($this->data[1]) - 1);
            $bs->appendNum(4, ord($this->data[0]) - 1);
            $bs->appendNum(8, ord($this->data[2]));

            $this->bstream = $bs;
            return 0;

        } catch (Exception $e) {
            return -1;
        }
    }
403658
private String encodeUri( String uri )
    {
        String newUri = "";
        StringTokenizer st = new StringTokenizer( uri, "/ ", true );
        while ( st.hasMoreTokens())
        {
            String tok = st.nextToken();
            if ( tok.equals( "/" ))
                newUri += "/";
            else if ( tok.equals( " " ))
                newUri += "%20";
            else
            {
                newUri += URLEncoder.encode( tok );
                // For Java 1.4 you'll want to use this instead:
                // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {}
            }
        }
        return newUri;
    }
64619
function decodePubModes(string) {
	var decStr, mode, i, l;
	decStr = decodeString(string);
	mode = {raw : false, merge : false,	distinct : false, command : false};

	if (decStr) {
		l = decStr.length;
		for(i = 0; i < l; i++) {
			if (decStr.charAt(i) === modeValues.RAW) {
				mode.raw = true;
			} else if (decStr.charAt(i) === modeValues.MERGE) {
				mode.merge = true;
			} else if (decStr.charAt(i) === modeValues.DISTINCT) {
				mode.distinct = true;
			} else if (decStr.charAt(i) === modeValues.COMMAND) {
				mode.command = true;
			} else {
				throw new Error('Invalid mode "' + decStr.charAt(i) + '"');
			}

		}
	}
	return mode;
}
798116
private void encodeCodecData(final RevisionCodecData codecData)
		throws EncodingException
	{

		this.codecData = codecData;

		// C
		data.writeBit(0);
		data.writeBit(0);
		data.writeBit(0);

		// BLOCK SIZES - S E B L
		this.data.writeValue(5, codecData.getBlocksizeS());
		this.data.writeValue(5, codecData.getBlocksizeE());
		this.data.writeValue(5, codecData.getBlocksizeB());
		this.data.writeValue(5, codecData.getBlocksizeL());

		// 1 Bit
		data.writeFillBits();
	}
251815
private byte[][] decode(byte[] encodedPublicKey) {
        byte[][] decodedKey = new byte[2][];
        decodedKey[MODULUS] = new byte[MODULUS_LENGTH];
        decodedKey[EXPONENT] = new byte[EXPONENT_LENGTH];
        System.arraycopy(encodedPublicKey, 0, decodedKey[MODULUS], 0, MODULUS_LENGTH);
        System.arraycopy(encodedPublicKey, MODULUS_LENGTH, decodedKey[EXPONENT], 0, EXPONENT_LENGTH);
        return decodedKey;
    }
276109
function fixedEncodeURIComponent (str) {
    return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
      return '%' + c.charCodeAt(0).toString(16);
    });
  }
695397
function paramsToString (params) {
  const paramKvs = keys(mapKeys(params, (v, k) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`))
  return join(paramKvs.sort(), '&')
}
246826
public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {
		return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);
	}
560718
protected function _encodeWithSchemas()
    {
        if ($this->viewVars['_inflect'] === 'dasherize') {
            $this->_dasherizeIncludesViewVar();
        }

        // All "Schema is not registered for a resource at path 'xyz'" errors
        // originate from the line below and are caused by the mentioned Cake Table
        // object not being present in the  `_repositories` viewVar array.
        $schemas = $this->_entitiesToNeoMerxSchema($this->viewVars['_repositories']);

        // Please note that a third NeoMerx EncoderOptions argument `depth`
        // exists but has not been implemented in this plugin.
        $encoder = Encoder::instance(
            $schemas,
            new EncoderOptions(
                $this->_jsonOptions()
            )
        );

        $serialize = null;
        if (isset($this->viewVars['_serialize'])) {
            $serialize = $this->viewVars['_serialize'];
        }

        if (isset($this->viewVars['_serialize']) && $this->viewVars['_serialize'] !== false) {
            $serialize = $this->_getDataToSerializeFromViewVars($this->viewVars['_serialize']);
        }

        // By default the listener will automatically add all associated data
        // (as produced by containable and thus present in the entity) to the
        // '_include' viewVar which is used to produce the top-level `included`
        // node UNLESS user specified an array with associations using the
        // listener config option `include`.
        //
        // Please be aware that `include` will take precedence over the
        //`getIncludePaths()` method that MIGHT exist in custom NeoMerx schemas.
        //
        // Lastly, listener config option `fieldSets` may be used to limit
        // the fields shown in the result.
        $include = $this->viewVars['_include'];
        $fieldSets = $this->viewVars['_fieldSets'];

        $parameters = new EncodingParameters(
            $include,
            $fieldSets
        );

        // Add optional top-level `version` node to the response if enabled
        // by user using listener config option.
        if ($this->viewVars['_withJsonApiVersion']) {
            if (is_array($this->viewVars['_withJsonApiVersion'])) {
                $encoder->withJsonApiVersion($this->viewVars['_withJsonApiVersion']);
            } else {
                $encoder->withJsonApiVersion();
            }
        }

        // Add top-level `links` node with pagination information (requires
        // ApiPaginationListener which will have set/filled viewVar).
        if (isset($this->viewVars['_pagination'])) {
            $pagination = $this->viewVars['_pagination'];

            $encoder->withLinks($this->_getPaginationLinks($pagination));

            // Additional pagination information has to be in top-level node `meta`
            $this->viewVars['_meta']['record_count'] = $pagination['record_count'];
            $this->viewVars['_meta']['page_count'] = $pagination['page_count'];
            $this->viewVars['_meta']['page_limit'] = $pagination['page_limit'];
        }

        // Add optional top-level `meta` node to the response if enabled by
        // user using listener config option.
        if (!empty($this->viewVars['_meta'])) {
            if (empty($serialize)) {
                return $encoder->encodeMeta($this->viewVars['_meta']);
            } else {
                $encoder->withMeta($this->viewVars['_meta']);
            }
        }

        // JSON API as generated by NeoMerx. When things look off,  start debugging here
        $neoMerxEncodedJson = $encoder->encodeData($serialize, $parameters);

        return $neoMerxEncodedJson;
    }
535001
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;

        SMBUtil.writeInt2(this.hashAlgos != null ? this.hashAlgos.length : 0, dst, dstIndex);
        SMBUtil.writeInt2(this.salt != null ? this.salt.length : 0, dst, dstIndex + 2);
        dstIndex += 4;

        if ( this.hashAlgos != null ) {
            for ( int hashAlgo : this.hashAlgos ) {
                SMBUtil.writeInt2(hashAlgo, dst, dstIndex);
                dstIndex += 2;
            }
        }

        if ( this.salt != null ) {
            System.arraycopy(this.salt, 0, dst, dstIndex, this.salt.length);
            dstIndex += this.salt.length;
        }

        return dstIndex - start;
    }
69384
protected function encodeContents()
    {
        $serverIDEncoded = StringType::write($this->serverID);

        $encodedPublicKey = base64_decode($this->getPublicKey());
        $publicKeyLength = VarInt::writeUnsignedVarInt(strlen($encodedPublicKey));

        $encodedToken = $this->getToken();
        $tokenLength = VarInt::writeUnsignedVarInt(strlen($encodedToken));

        return $serverIDEncoded->getEncoded() . $publicKeyLength->getEncoded() . $encodedPublicKey . $tokenLength->getEncoded() . $encodedToken;
    }
1215218
public static function encodeUri($uri)
    {
        $uri = self::removeSchemeFromUri($uri, $scheme);
        $uri = rawurlencode($uri);

        // Decode slashes
        $uri = str_replace("%2F", "/", $uri);

        return $scheme . $uri;
    }
1083273
function ucs2encode(array) {
  return _.map(array, function (value) {
    var output = '';

    if (value > 0xFFFF) {
      value -= 0x10000;
      output += String.fromCharCode(value >>> 10 & 0x3FF | 0xD800);
      value = 0xDC00 | value & 0x3FF;
    }
    output += String.fromCharCode(value);
    return output;
  }).join('');
}
1213033
def encode_params(uri, params)
      params_str = String.new('?')
      params.each do |k, v|
        params_str << "#{k}=#{CGI.escape(v.to_s)}&" if v
      end
      params_str.chop!
      uri + params_str
    end