Configure proper charset.

@param array $options
@return string
554564
private function configureCharset(array $options)
    {
        $charset = 'AL32UTF8';
        // Get the character set from the options.
        if (array_key_exists('charset', $options)) {
            $charset = $options['charset'];
        }
        // Convert UTF8 charset to AL32UTF8
        $charset = strtolower($charset) == 'utf8' ? 'AL32UTF8' : $charset;

        return $charset;
    }
150606
protected function _options($options) {
		$e = [];
		foreach ($options as $option => $value) {
			if ($value === null) {
				continue;
			}
			if (is_string($value)) {
				$value = '\'' . $value . '\'';
			} elseif (is_object($value)) { // Datetime?
				$value = $this->_date($value);
			} elseif (is_bool($value)) {
				$value = $value ? 'true' : 'false';
			} else {
				$value = str_replace('\'', '\\\'', $value);
			}
			$e[] = '\'' . $option . '\': ' . $value;
		}
		$string = '{' . PHP_EOL . "\t" . implode(',' . PHP_EOL . "\t", $e) . PHP_EOL . '}';
		return $string;
	}
980395
public function actionTranslation($options)
    {
        if (!is_array($options)) {
            return $this->translator->trans($options, [], 'CmsKernelAdminBridge');
        }

        $resultOptions = [];
        foreach ($options as $optionKey => $option) {
            $option = null === json_decode($option, true) ? $option : json_decode($option, true);

            if (is_array($option)) {
                foreach ($option as $iterationKey => $iteration) {
                    if (is_array($iteration)) {
                        foreach ($iteration as $iKey => $i) {
                            if (is_array($i)) {
                                foreach ($i as $iiKey => $ii) {
                                    $resultOptions[$optionKey][$iterationKey][$iKey][$iiKey] = $this->translator->trans($ii, [], 'CmsKernelAdminBridge');
                                }
                            } else {
                                $resultOptions[$optionKey][$iterationKey][$iKey] = $this->translator->trans($i, [], 'CmsKernelAdminBridge');
                            }
                        }
                    } else {
                        $resultOptions[$optionKey][$iterationKey] = $this->translator->trans($iteration, [], 'CmsKernelAdminBridge');
                    }
                }
            } else {
                $resultOptions[$optionKey] = $this->translator->trans($option, [], 'CmsKernelAdminBridge');
            }
        }

        return $resultOptions;
    }
353851
protected function prepareConstructOption($options) {
        if ($options instanceof DatabaseConfiguration) {
            $options = $options->toArray();
        }
        $opts          = array_merge([
            'encoding'       => 'UTF8',
            'dbname'         => ':memory:',
            'host'           => 'localhost',
            'port'           => 3306,
            'user'           => 'root',
            'password'       => 'root',
            'driver_options' => []
        ], $options);
        $charset       = isset ($opts ['encoding']) && !empty ($opts ['encoding']) ? $opts ['encoding'] : 'UTF8';
        $dsn           = "sqlite:{$opts['dbname']}";
        $this->charset = $charset;

        return [$dsn, $opts ['user'], $opts ['password'], $opts ['driver_options']];
    }
225935
public static function acceptsOptions( array $options )
    {
        $tl = strlen( static::TYPE );

        return isset( $options['type'] ) && (
            static::TYPE == $options['type'] || (
                strlen( $options['type'] ) > $tl &&
                ( static::TYPE . '.' ) == substr( $options['type'], 0, $tl + 1 )
            )
        );
    }
883930
protected function renderOptionTags($options)
    {
        $output = '';
        if ($this->hasArgument('prependOptionLabel')) {
            $value = $this->hasArgument('prependOptionValue') ? $this->arguments['prependOptionValue'] : '';
            if ($this->hasArgument('translate')) {
                $label = $this->getTranslatedLabel($value, $this->arguments['prependOptionLabel']);
            } else {
                $label = $this->arguments['prependOptionLabel'];
            }

            $output .= $this->renderOptionTag($value, $label) . chr(10);
        } elseif (empty($options)) {
            $options = array('' => '');
        }
        foreach ($options as $value => $label) {
            $output .= $this->renderOptionTag($value, $label) . chr(10);
        }
        return $output;
    }
385857
private function _optionsToString(array $options)
    {
        $str = '';
        foreach ($options as $key => $val) {
            if ($key === 'password')
                $val = '*****';
            if ($str)
                $str .= ',';
            $str .= $key . '=' . $val;
        }
        return $str;
    }
1048122
public function setOptions(array $options)
    {
        if ($options) {
            foreach ($options as $k => $v) {
                $this->options[$k] = $v;
            }
        }
        
        static::formatName();
        
        return $this;
    }
428687
public function createLink(array $options)
    {
        $str = ' ';
        foreach ($options as $key => $value) {
            if (($str !== ' ')) {
                $str .= ' '.$key.'="'.$value.'"';
            } else {
                $str .= $key.'="'.$value.'"';
            }
        }

        $html = '<link' . $str;
        if ($this->doctype == self::DOCTYPE_XHTML1_0_FRAMESET ||
                $this->doctype == self::DOCTYPE_XHTML1_0_STRICT ||
                $this->doctype == self::DOCTYPE_XHTML1_0_TRANSITIONAL) {
            $html .= '/>';
        } else {
            $html .= '>';
        }

        return $html;
    }
1217040
public static function toQueryString($options = array())
    {
        $temp = array();
        uksort($options, 'strnatcasecmp');
        foreach ($options as $key => $value) {
            if (is_string($key) && !is_array($value)) {
                $temp[] = rawurlencode($key) . '=' . rawurlencode($value);
            }
        }
        return implode('&', $temp);
    }
1203793
public function setJsonOptions($options)
    {
        $this->encodingOptions = (int) $options;

        return $this->setData($this->getData());
    }
315259
public function setOptions($options)
    {
        if ($this->step !== null) {
            throw new \RuntimeException('Cannot change encoding options during encoding');
        }

        $this->options = (int) $options;
        return $this;
    }
251714
public function currency($options = array())
    {
        $options = new AnConfig($options);

        $options->append(array(
            'name' => 'currency',
            'prompt' => true,
        ));

        $selected = $options->selected;
        unset($options->selected);
        $currencies = array_combine(self::$ISO_CURRENCY_SYMBOLS, self::$ISO_CURRENCY_SYMBOLS);

        return $this->_html->select($options->name, array('options' => $currencies, 'selected' => $selected), AnConfig::unbox($options));
    }
103617
public function getIdFromOptions(array $options) : string
    {
        $optionsResolver = new OptionsResolver();
        $optionsResolver->setRequired('id');

        $options = $optionsResolver->resolve($options);

        return $options['id'];
    }
1370181
protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }

        extract($options['array']);
        /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */
        $comma = false;

        $tab = str_repeat($char, $indent * $multiplier);

        $string = "[\n";

        foreach ($data as $key => $value) {
            if ($comma) {
                $string .= ",\n";
            }
            $comma = true;
            $key = filter_var($key, FILTER_VALIDATE_INT) ? $key : static::dump($key, $options['quote']);
            $string .= $tab . $key . ' => ';
            if (is_array($value)) {
                $options['array']['indent'] = $indent + 1;
                $string .= static::_arrayToString($value, $options);
            } else {
                $string .= static::toString($value, $options);
            }
        }
        $tab = str_repeat($char, ($indent - 1) * $multiplier);
        return $string . "\n" . $tab . "]";
    }
507753
protected static function checkOptions(array $options)
    {
        if (isset($options['value'])) {
            $value = $options['value'];
            unset($options['value']);
            $options['value'] = $value;
        }

        return $options;
    }
645875
protected function convertContextOptions(array $options)
    {
        $contextOptions = [];
        foreach ($options as $key => $value) {
            $section = 'http';
            if (strpos($key, 'ssl') === 0) {
                $section = 'ssl';
                $key = substr($key, 3);
            }
            $key = Inflector::underscore($key);
            $contextOptions[$section][$key] = $value;
        }

        return $contextOptions;
    }