Get the message charset
974292
def get_charset(message, default="utf-8"):
    """"""
    if message.get_content_charset():
        return message.get_content_charset()
    if message.get_charset():
        return message.get_charset()
    return default
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;
     }
622501
public int getMessageLength(){
		if(this.identifierRegex == null){
			return 1;
		}
		try {
			return this.identifierRegex.getBytes("UTF-16BE").length + 1;
		} catch (UnsupportedEncodingException e) {
			log.error("Unable to decode UTF-16BE String: {}", e);
			return 1;
		}
	}
168121
protected static Charset getCharset(final Map<String, String> properties) {
		String charsetName = properties.get("charset");
		try {
			return charsetName == null ? Charset.defaultCharset() : Charset.forName(charsetName);
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.ERROR, "Invalid charset: " + charsetName);
			return Charset.defaultCharset();
		}
	}
959773
public static function charsetDecode($input,$_input_charset ,$_output_charset) {
        $output = "";
        if(!isset($_input_charset) )$_input_charset  = $_input_charset ;
        if($_input_charset == $_output_charset || $input ==null ) {
            $output = $input;
        } elseif (function_exists("mb_convert_encoding")) {
            $output = mb_convert_encoding($input,$_output_charset,$_input_charset);
        } elseif(function_exists("iconv")) {
            $output = iconv($_input_charset,$_output_charset,$input);
        } else die("sorry, you have no libs support for charset changes.");
        return $output;
    }
584033
def _get_encoding():
    """"""

    encoding = sys.getfilesystemencoding()
    if encoding is None:
        if is_darwin:
            encoding = "utf-8"
        elif is_win:
            encoding = "mbcs"
        else:
            encoding = "ascii"
    encoding = _normalize_codec(encoding)
    return encoding
930015
function (msgctxt, msgid) {
  var message;
  if (this.$i18n.getLocaleMessage(this.$i18n.activeLocale)[msgctxt]) {
    message = this.$i18n.getLocaleMessage(this.$i18n.activeLocale)[msgctxt][msgid];
  }

  if (!message) {
    return msgid
  } else {
    return message.msgstr[0] || message.msgid
  }
}
730010
def get_encodings_from_content(content):
    

    charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)

    return charset_re.findall(content)
528933
public String getCharacterEncoding() {

		if (this.message.getContentEncoding() != null) {
			return this.message.getContentEncoding().getEncoding();
		} else {
			ContentTypeHeader cth = (ContentTypeHeader)
				this.message.getHeader(ContentTypeHeader.NAME);
			if(cth == null) return null;
			return cth.getParameter("charset");
		}
	}
827994
public int getMessageLength() {
    // Message type, Id length
    int length = 1 + 4;

    if (this.identifier != null) {
      try {
        length += this.identifier.getBytes("UTF-16BE").length;
      } catch (UnsupportedEncodingException e) {
        log.error("Unable to encode to UTF-16BE.");
      }
    }

    // Attribute name length
    length += 4;

    if (this.attributeName != null) {
      try {
        length += this.attributeName.getBytes("UTF-16BE").length;
      } catch (UnsupportedEncodingException e) {
        log.error("Unable to encode to UTF-16BE.");
      }
    }

    if (this.origin != null) {
      try {
        length += this.origin.getBytes("UTF-16BE").length;
      } catch (UnsupportedEncodingException uee) {
        log.error("Unable to encode to UTF-16BE.");
      }
    }

    return length;
  }
506728
public static String getMessageText(I_CmsMessageBundle messages, String key, Object... args) {

        return messages.getBundle(A_CmsUI.get().getLocale()).key(key, args);
    }
320623
private static Charset getCharset(final int flags) throws AuthenticationException
    {
        if ((flags & FLAG_REQUEST_UNICODE_ENCODING) == 0) {
            return DEFAULT_CHARSET;
        } else {
            if (UNICODE_LITTLE_UNMARKED == null) {
                throw new AuthenticationException( "Unicode not supported" );
            }
            return UNICODE_LITTLE_UNMARKED;
        }
    }
592305
def get_string():
    """"""
    keycodes = _get_keycodes()
    initial_code, codes = keycodes[0], keycodes[1:]
    initial_char = chr(initial_code)
    if initial_code == 27:
        initial_char = '\\e'
    elif not ascii.isgraph(initial_char):
        initial_char = '\\x%x' % initial_code
    chars = ''.join([chr(c) for c in codes])
    return ''.join((initial_char, chars))
178743
public MessageProtocol withCharset(String charset) {
        return new MessageProtocol(contentType, Optional.ofNullable(charset), version);
    }
1021930
def get_content_type_charset(self, default='UTF-8'):
		
		encoding = default
		header = self.headers.get('Content-Type', '')
		idx = header.find('charset=')
		if idx > 0:
			encoding = (header[idx + 8:].split(' ', 1)[0] or encoding)
		return encoding
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");
  }
73846
public Charset getCharSet() {
		String charSet = getParameter(PARAM_CHARSET);
		return (charSet != null ? Charset.forName(unquote(charSet)) : null);
	}