Encode a marker.

@param Marker  $marker  The marker.
@param Encoder $encoder The encoder.

@return bool
428630
public function encodeMarker(Marker $marker, Encoder $encoder)
    {
        return sprintf(
            '%s = L.marker(%s);',
            $encoder->encodeReference($marker),
            $encoder->encodeArguments(
                array(
                    $marker->getLatLng(),
                    $marker->getOptions()
                )
            )
        );
    }
330293
public function setEncoding($encoding)
    {
        $encoding = trim($encoding);
        if ($encoding !== '') {
            $this->flags .= " --default-encoding $encoding";
        } else {
            $this->flags = str_replace(
                ' --default-encoding ' . $this->encoding,
                '',
                $this->flags
            );
        }
        $this->encoding = $encoding;
    }
445708
private function encodeLayersInformation($layers, Encoder $encoder)
    {
        $layers = array_map(
            function ($layer) use ($encoder) {
                return $encoder->encodeReference($layer);
            },
            $layers
        );

        return '[' . implode(', ', $layers) . ']';
    }
690928
public function encodeTileLayer(TileLayer $layer, Encoder $builder)
    {
        return sprintf(
            '%s = L.tileLayer(%s);',
            $builder->encodeReference($layer),
            $builder->encodeArguments(array($layer->getUrl(), $layer->getOptions()))
        );
    }
808832
public function encodeGeoJson(GeoJson $geoJson, Encoder $encoder)
    {
        $buffer = sprintf(
            '%s = L.geoJson(%s, %s);',
            $encoder->encodeReference($geoJson),
            $encoder->encodeValue($geoJson->getInitializationData()),
            $encoder->encodeValue($geoJson->getOptions())
        );

        foreach ($geoJson->getLayers() as $layer) {
            $buffer .= "\n" . sprintf(
                '%s.addLayer(%s);',
                $encoder->encodeReference($geoJson),
                $encoder->encodeReference($layer)
            );
        }

        return $buffer;
    }
783991
public function append($tag, $value, $encode = true)
    {
        if ($value instanceof URL) {
            $value = $value->__toString();
        }
        // Temporary here until we finish testing
        if ($encode
            && $value != $this->app->encodeHtmlChars($value, ENT_NOQUOTES)
            && $this->app->getConfig('html_injection_debug', false)
        ) {
            throw $this->exception('Attempted to supply html string through append()')
                ->addMoreInfo('val', var_export($value, true))
                ->addMoreInfo('enc', var_export($this->app->encodeHtmlChars($value, ENT_NOQUOTES), true))
                //->addAction('ignore','Ignore tag'.$tag)
                ;
        }
        if ($encode) {
            $value = $this->app->encodeHtmlChars($value, ENT_NOQUOTES);
        }
        if ($this->isTopTag($tag)) {
            $this->template[] = $value;

            return $this;
        }
        if (!isset($this->tags[$tag]) || !is_array($this->tags[$tag])) {
            throw $this->exception("Cannot append to tag $tag")
                ->addMoreInfo('by', $this->owner);
        }
        foreach ($this->tags[$tag] as $key => $_) {
            if (!is_array($this->tags[$tag][$key])) {
                //throw new BaseException("Problem appending '".
                //      $this->app->encodeHtmlChars($value)."' to '$tag': key=$key");
                $this->tags[$tag][$key] = array($this->tags[$tag][$key]);
            }
            $this->tags[$tag][$key][] = $value;
        }

        return $this;
    }
576261
public static function getDescription($marker)
    {
        if (array_key_exists($marker, self::$jpegMarkerShort)) {
            if (array_key_exists($marker, self::$jpegMarkerDescriptions)) {
                return self::$jpegMarkerDescriptions[$marker];
            } else {
                $splitted = preg_split(
                    "/(\d+)/",
                    self::$jpegMarkerShort[$marker],
                    - 1,
                    PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
                );
                if ((count($splitted) == 2) && array_key_exists($splitted[0], self::$jpegMarkerDescriptions)) {
                    return Pel::fmt(self::$jpegMarkerDescriptions[$splitted[0]], $splitted[1]);
                }
            }
        }
        return Pel::fmt('Unknown marker: 0x%02X', $marker);
    }
407364
public static function encode($encodingLabel, $text)
    {
        $encodingLabel = self::normalizeEncoding($encodingLabel);
        if ($encodingLabel === 'UTF-8') {
            return Encoding::toUTF8($text);
        }
        if ($encodingLabel === 'ISO-8859-1') {
            return Encoding::toLatin1($text);
        }
    }
958223
private function doGroupEncode($type, LayerGroup $group, Encoder $encoder)
    {
        return sprintf(
            '%s = L.%s(%s);',
            $encoder->encodeReference($group),
            $type,
            $this->encodeLayersInformation($group->getLayers(), $encoder)
        );
    }
1041886
protected function getReferences(array $values, Encoder $encoder)
    {
        return array_map(
            function ($value) use ($encoder) {
                return $encoder->encodeReference($value);
            },
            $values
        );
    }
737609
def setEncoder(self, encoder):
        
        if not encoder:
            self._encoder = json.JSONEncoder()
        else:
            self._encoder = encoder
        self._encode = self._encoder.encode
380974
public static function setEncoding($encoding) {

		if(false === is_string($encoding) || 0 === strlen($encoding)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($encoding)), E_USER_ERROR);
		}

		$encoding = strtolower($encoding);

		if(false === in_array($encoding, static :: $encodings)) {
			return trigger_error(sprintf('Argument 1 passed to %s() is not a supported encoding. Provide an encoding supported by htmlspecialchars()', __METHOD__), E_USER_ERROR);
		}

		static :: $encoding = $encoding;
	}
561811
public static function encode($encodingLabel, $text)
    {
        $encodingLabel = self::normalizeEncoding($encodingLabel);
        if ($encodingLabel == 'ISO-8859-1')
            return self::toWin1252($text);
        return self::toUTF8($text);
    }
1004125
public function handleEncode(EncodeValueEvent $event)
    {
        $definition = $event->getValue();
        if (!$definition instanceof Definition) {
            return;
        }

        $type   = $definition->getType();
        $method = 'encode' . $this->convertTypeToMethod($type);

        if (method_exists($this, $method)) {
            $buffer = $this->$method($definition, $event->getEncoder(), $event->getJsonFlags());

            if ($buffer) {
                $event->addLine($buffer);
                $this->handleMethodCalls($definition, $event->getEncoder(), $event);
            }

            $event->setSuccessful();
        }
    }
1294456
public static function getName($marker)
    {
        if (array_key_exists($marker, self::$jpegMarkerShort)) {
            return self::$jpegMarkerShort[$marker];
        } else {
            return Pel::fmt('Unknown marker: 0x%02X', $marker);
        }
    }
156674
private function findDecoderByKey(string $encoderKey): MessageDecoder
    {
        /** @var string $encoderContainerId */
        $encoderContainerId = true === !empty($this->decodersConfiguration[$encoderKey])
            ? $this->decodersConfiguration[$encoderKey]
            : self::DEFAULT_DECODER;

        return $this->obtainDecoder($encoderContainerId);
    }
170824
function Encoder(options) {
  options = options || {};
  Transform.call(this, {objectMode: true});

  // string length chunk for bulk strings, strings large than this amount
  // are broken over process ticks so as not to block the event loop
  // note this is character length, not byte length
  this.strlen = options.strlen || 4096;

  // maximum array length before iterating using
  // setImmediate
  this.arrlen = 512;

  // allow buffers to be passed through untouched
  this.buffers = options.buffers;

  // treat buffers as bulk strings
  this.return_buffers = options.return_buffers;
}