Returns the charset accepted.

@return null|string
548247
private function detectCharset(ServerRequestInterface $request)
    {
        $accept = $request->getHeaderLine('Accept-Charset');

        return $this->negotiateHeader($accept, new CharsetNegotiator(), $this->charsets);
    }
252692
public function getCharsets()
    {
        if (!isset($this->_charsets))
        {
            $this->_charsets = array();

            if($this->_headers->has('Accept-Charset'))
            {
                $accept   = $this->_headers->get('Accept-Charset');
                $charsets = $this->_parseAccept($accept);

                $this->_charsets = array_keys($charsets);
            }
        }

        return $this->_charsets;
    }
1070330
public function getUtf8Value()
    {
        if (strcasecmp($this->encoding, 'utf8') == 0  
            || strcasecmp($this->encoding, 'utf-8') == 0 
        ) {
                return $this->value;
        } else {

            return (PHP_OS != 'AIX') ? iconv($this->encoding, 'UTF-8', $this->value) : iconv('ISO8859-1', 'UTF-8', $this->value);
        }
    }
797122
public function getCharacterApi()
    {
        if (!$this->apis->has('character')) {
            $this->apis->set('character', new Character($this));
        }

        return $this->apis->get('character');
    }
876084
protected function setCharsets()
    {
        if ((count($this->charsets) === 0) && ! empty($_SERVER[ 'HTTP_ACCEPT_CHARSET' ])) {
            $this->charsets = explode(
                ',',
                preg_replace(
                    '/(;\s?q=.+)|\s/i',
                    '',
                    strtolower(trim($_SERVER[ 'HTTP_ACCEPT_CHARSET' ]))
                )
            );
        }

        if (count($this->charsets) === 0) {
            $this->charsets = ['Undefined'];
        }
    }
800438
protected function validateNameLanguage()
    {
        $field = 'name';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return true; // If not set, code will be used instead
        }

        if (mb_strlen($value) > 50) {
            $this->setErrorLengthRange($field, $this->translation->text('Name'), 0, 50);
            return false;
        }

        return true;
    }
668001
public function getEncoding()
    {
        $content = $this->getHeaderLine('content-type');
        if (!$content) {
            return null;
        }
        preg_match('/charset\s?=\s?[\'"]?([a-z0-9-_]+)[\'"]?/i', $content, $matches);
        if (empty($matches[1])) {
            return null;
        }

        return $matches[1];
    }
62307
public Charset getCharset() {
    if (bootstrapEvent != null) {
      return Charset.forName(bootstrapEvent.getDefaultCharsetName());
    } else {
      return Charset.defaultCharset();
    }
  }
723035
public Charset contentCharset() {
        String ct = contentType();
        if (ct != null) {
            int index = ct.indexOf("charset=");
            if (index != -1) {
                return Charset.forName(ct.substring(index + 8));
            } else {
                return null;
            }
        } else {
            return null;
        }
    }
1011882
public static function get_charset()
    {
        if (self::$default_charset) {
            return self::$default_charset;
        }

        if ($charset = rcube::get_instance()->config->get('default_charset')) {
            return $charset;
        }

        return RCUBE_CHARSET;
    }
1353766
public Charset getCharset() {
    // RFC2616 3.7
    for (String type : this.request.headers().getAll("Content-Type")) {
      int idx = type.toUpperCase().indexOf("CHARSET=");
      if (idx > 1) {
        String charset = type.substring(idx+8);
        return Charset.forName(charset);
      }
    }
    return Charset.forName("UTF-8");
  }
794730
private function _source_result_charset()
     {
        if( preg_match("/^utf/", $this->targetCharSet) ) {
           $rs = 1;
        }
        else if( preg_match("/^gb/", $this->targetCharSet) ) {
           $rs = 2;
        }
        else if( preg_match("/^big/", $this->targetCharSet) ) {
           $rs = 3;
        }
        else {
            $rs = 4;
        }
        return $rs;
     }
863391
protected function hasPreviousCharacter()
	{
		return key($this->characters) !== null 
			&& array_key_exists(key($this->characters) - 1, $this->characters);
	}
871046
@Nullable
  public String getCharSet ()
  {
    // Parameter parser can handle null input
    final ICommonsMap <String, String> aParams = new ParameterParser ().setLowerCaseNames (true)
                                                                       .parse (getContentType (), ';');
    return aParams.get ("charset");
  }
1195374
public function getSupportedCharsets()
    {
        if ($this->supportedCharsets === null) {
            $supportedCharsets = [];
            $rs = $this->executeQuery('SHOW CHARACTER SET');
            while (($row = $rs->fetch(PDO::FETCH_ASSOC)) !== false) {
                if (!isset($row['Charset']) || !isset($row['Default collation'])) {
                    throw new Exception(t('Unrecognized result of the "%s" database query.', 'SHOW CHARACTER SET'));
                }
                $supportedCharsets[strtolower($row['Charset'])] = strtolower($row['Default collation']);
            }
            $this->supportedCharsets = $supportedCharsets;
        }

        return $this->supportedCharsets;
    }
447590
public List<Charset> getAcceptCharset() {
		List<Charset> result = new ArrayList<Charset>();
		String value = getFirst(ACCEPT_CHARSET);
		if (value != null) {
			String[] tokens = value.split(",\\s*");
			for (String token : tokens) {
				int paramIdx = token.indexOf(';');
				String charsetName;
				if (paramIdx == -1) {
					charsetName = token;
				}
				else {
					charsetName = token.substring(0, paramIdx);
				}
				if (!charsetName.equals("*")) {
					result.add(Charset.forName(charsetName));
				}
			}
		}
		return result;
	}
1088460
private function _getCharset($charset=null)
    {
        if (! $charset) {
            return;
        }

        $expr   = '/^(charset=)(\w+)$/';
        $tokens = array_filter(
            $charset, function ($token) use ($expr) {
                return preg_match($expr, $token, $matches);
            }
        );
        if (count($tokens) > 0) {
            preg_match($expr, array_shift($tokens), $matches);
            $_charset = $matches[2];
        } else {
            $_charset = null;
        }

        return $_charset;
    }