Wrapper for strtoupper.

@param string|null $encoding

@return TransformerWorker
349576
public function upper($encoding = null)
    {
        if (!$this->hasMbstring()) {
            return $this->transform('\strtoupper');
        }

        $encoding = $this->encoding($encoding);

        return $this->transform('\mb_convert_case', MB_CASE_UPPER, $encoding);
    }
1251387
public function setEncoding($encoding = null)
    {
        if ($encoding !== null) {
            $orig   = iconv_get_encoding('internal_encoding');
            $result = iconv_set_encoding('internal_encoding', $encoding);
            if (!$result) {
                require_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception('Given encoding not supported on this OS!');
            }

            iconv_set_encoding('internal_encoding', $orig);
        }

        $this->_encoding = $encoding;
        return $this;
    }
1061176
public static function lower($str, $encoding = null) {
        $encoding or $encoding = \Fuel::$encoding;
        return function_exists('mb_strtolower') ? mb_strtolower($str, $encoding) : strtolower($str);
    }
51684
public static function encode($input, $encoding)
    {
        switch (strtolower($encoding)) {
            case 'utf-8':
                $output = $input;
                break;
            
            case 'x-user-defined':
                $output = preg_replace_callback('/[^\\x00-\\x7F]/u', function ($matches) {
                    $codePoint = self::getCodePoint($matches[0]);
                    return $codePoint <= 0xF7FF ? chr($codePoint - 0xF780 + 0x80) : '&#' . $codePoint . ';';
                }, $input);
                break;
            
            default:
                $output = self::convertEncoding($input, $encoding);
        }
        
        return $output;
    }
410770
public static function shift(string &$str, string $encoding = null)
    {
        $encoding = $encoding ?: mb_internal_encoding();

        $first = mb_substr($str, 0, 1, $encoding);
        $str = mb_substr($str, 1, null, $encoding);

        return $first;
    }
135741
public static function upper( $string, $encoding = null )
	{
		if ( is_null( $encoding ) )
		{
			$encoding = ClanCats::$config->charset;
		}
		return mb_strtoupper( $string, $encoding );
	}
205046
public static function pop(string &$str, string $encoding = null)
    {
        $encoding = $encoding ?: mb_internal_encoding();

        $last = mb_substr($str, -1, null, $encoding);
        $str = mb_substr($str, 0, -1, $encoding);

        return $last;
    }
293827
public function ucwords($str, $encoding = null)
	{
		$encoding or $encoding = $this->encoding;

		return function_exists('mb_convert_case')
			? mb_convert_case($str, MB_CASE_TITLE, $encoding)
			: ucwords(strtolower($str));
	}
1311201
protected function getEncoding($encoding=null)
    {
        if(is_null($encoding))
        {
            if(!is_null($this->encoding))
            {
                return $this->encoding;
            }
            return self::getDefaultEncoding();
        }
        return $encoding;
    }
31837
public static function ucfirst($str, $encoding = 'UTF-8') {
        $encoding or $encoding = 'UTF-8';
        return function_exists('mb_strtoupper') ? mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, mb_strlen($str, $encoding), $encoding) : ucfirst($str);
    }
60840
private static TransformerHandler getTransformerHandler(OutputStream out, String method,
                                                            String encoding)
        throws TransformerConfigurationException {

        TransformerHandler transformerHandler = SAX_TRANSFORMER_FACTORY.newTransformerHandler();
        Transformer transformer = transformerHandler.getTransformer();
        transformer.setOutputProperty(OutputKeys.METHOD, method);
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");

        if (encoding != null) {
            transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
        }

        transformerHandler.setResult(new StreamResult(new PrintStream(out)));
        return transformerHandler;
    }
1051660
private function utf8ToCharset($content, $encoding = null)
    {
        if ('UTF-8' !== $encoding && !empty($encoding)) {
            if (function_exists('mb_convert_encoding')) {
                return mb_convert_encoding($content, $encoding, 'UTF-8');
            }

            if (function_exists('iconv')) {
                return iconv('UTF-8', $encoding, $content);
            }

            throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
        }

        return $content;
    }
1272468
public function setEncoding($encoding)
    {
        if (strlen($encoding) == 0) {
            throw new \InvalidArgumentException(sprintf('Encoding should not be empty'));
        }

        $this->encoding = $encoding;

        return $this;
    }
663325
public static function toggleCase($string, $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        return preg_replace_callback(
            '/[\S]/u',
            function ($match) use ($encoding) {
                if ($match[0] === Mbstring::strtoupper($match[0], $encoding)) {
                    return Mbstring::strtolower($match[0], $encoding);
                }

                return Mbstring::strtoupper($match[0], $encoding);
            },
            $string
        );
    }
210030
public function setTransferEncoding($encoding)
    {
        $encoding = strtolower($encoding);
        if (!in_array($encoding, $this->_transferEncodingAvailable)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Transfer encoding not available. Can be : %s.',
                    implode(', ', $this->_transferEncodingAvailable)
                )
            );
        }
        $this->transferEncoding = $encoding;

        return $this;
    }
735089
public static function title(string $str, string $encoding = null) : string
    {
        return mb_convert_case($str, MB_CASE_TITLE, $encoding ?: utils\Str::encoding($str));
    }
399078
public function setBodyHtml($html, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
    {
        if ($charset === null) {
            $charset = $this->_charset;
        }

        $mp = new Zend_Mime_Part($html);
        $mp->encoding = $encoding;
        $mp->type = Zend_Mime::TYPE_HTML;
        $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
        $mp->charset = $charset;

        $this->_bodyHtml = $mp;

        return $this;
    }