Extracts the charset from configuration. The default charset will be returned, if no charset is defined or the
defined charset doesn't exist.

@param properties
Configuration for writer
@return Configured charset
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();
		}
	}
354758
private Charset getCharset(final String value) {
        Charset c = null;
        if (value != null) {
            final String[] tokens = value.trim().split("[;=]");
            if (tokens.length >= 3 && tokens[1].trim().equals("charset")) {
                try {
                    c = Charset.forName(tokens[2].trim());
                } catch (final RuntimeException e) {
                    logger.error(MessageUtils.getMessage("DOTJ052E", tokens[2].trim()).toString());
                }
            }
        }
        if (c == null) {
            final String defaultCharset = Configuration.configuration.get("default.coderef-charset");
            if (defaultCharset != null) {
                c = Charset.forName(defaultCharset);
            } else {
                c = Charset.defaultCharset();
            }
        }
        return c;
    }
738723
public InterfaceConfigBuilder setMethodsCharset(Charset charset) {
        for (MethodConfigBuilder b : methodBuilders.values()) {
            b.setCharset(charset);
        }
        return this;
    }
32150
@Nonnull
	public static Configuration createConfiguration(Properties properties) {
		final Configuration configuration = new Configuration();

		final Set<String> propertyNames = properties.stringPropertyNames();

		for (String propertyName : propertyNames) {
			configuration.setString(propertyName, properties.getProperty(propertyName));
		}

		return configuration;
	}
913524
public static Character getPropertyCharacter(Class<?> aClass, String key,
			char defaultValue)
	{
		return getSettings().getPropertyCharacter(aClass, key, defaultValue);

	}
62307
public Charset getCharset() {
    if (bootstrapEvent != null) {
      return Charset.forName(bootstrapEvent.getDefaultCharsetName());
    } else {
      return Charset.defaultCharset();
    }
  }
1076089
private static Charset extractCharset(Metadata headers) {
    String contentType = headers.get(GrpcUtil.CONTENT_TYPE_KEY);
    if (contentType != null) {
      String[] split = contentType.split("charset=", 2);
      try {
        return Charset.forName(split[split.length - 1].trim());
      } catch (Exception t) {
        // Ignore and assume UTF-8
      }
    }
    return Charsets.UTF_8;
  }
488677
@SuppressWarnings("unchecked")
    public String getCharSet() {
        ParameterParser parser = new ParameterParser();
        parser.setLowerCaseNames(true);
        // Parameter parser can handle null input
        Map<String, String> params = parser.parse(getContentType(), ';');
        return params.get("charset");
    }
762922
public Reader createScript(Charset charset) {

		// Determine wether this is run-app or run-war style of runtime.
		boolean warDeployed = ((Boolean) this.servletContext
				.getAttribute(JawrGrailsConstant.GRAILS_WAR_DEPLOYED))
				.booleanValue();

		// Spring message bundle object, the same used by grails.
		GrailsBundleMessageSource messageSource = new GrailsBundleMessageSource(
				warDeployed);
		
		messageSource.setFallbackToSystemLocale(control.isFallbackToSystemLocale());
		messageSource.setFilters(filterList);

		if (warDeployed) {
			messageSource.setResourceLoader(new ServletContextResourceLoader(
					this.servletContext));

		}
		messageSource.setBasenames(getBaseNames(warDeployed));

		Properties props = messageSource.getAllMessages(locale);
		return doCreateScript(props);
	}
238414
public static Charset getCharset(CharSequence contentTypeValue) {
        if (contentTypeValue != null) {
            return getCharset(contentTypeValue, CharsetUtil.ISO_8859_1);
        } else {
            return CharsetUtil.ISO_8859_1;
        }
    }
378905
@Override
	public String interpret(String property)
	{
		try
		{
			property = Cryption.interpret(property);
			
			if(property != null && property.indexOf(Styles.DEFAULT_PREFIX) > -1)
			{
				property = Text.format(property,this.getProperties());
			}
		}
		catch (FormatException e)
		{
			throw new ConfigException("Format exception for \""+property+"\"",e);
		}
		
		return Cryption.interpret(property);
	}
669424
protected Charset getCharSet() {
		String contentType = urlConnection.getContentType();
		Charset charset = Charset.forName("iso-8859-1"); // default charset
		if (contentType != null) {
			// find out about the charset from the URLConnection
			Matcher m = charsetPattern.matcher(contentType);
			if (m.find()) {
				String charsetString = m.group(1);
				try {
					charset = Charset.forName(charsetString);
				} catch (IllegalCharsetNameException e) {
					e.printStackTrace();
				} catch (IllegalArgumentException e) {
					e.printStackTrace();
				}
			}
		}
		return charset;
	}
1327925
public void setMailDefaultCharset(String charset) throws PageException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL);
	if (!hasAccess) throw new SecurityException("no access to update mail server settings");

	if (!StringUtil.isEmpty(charset)) {
	    try {
		IOUtil.checkEncoding(charset);
	    }
	    catch (IOException e) {
		throw Caster.toPageException(e);
	    }
	}

	Element mail = _getRootElement("mail");
	mail.setAttribute("default-encoding", charset);
	// config.setMailDefaultEncoding(charset);
    }
605364
public static String normalizeCharset(String s) {
        String n = CHARSETS.get(s);
        return (n == null) ? s : n;
    }
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;
	}
574952
public static Charset getCharset(final InputStream inputStream) throws IOException
    {
        final Charset resultCharset;
        final byte[] buffer = new byte[192];
        final int reading = ByteStreams.read(inputStream, buffer, 0, 192);
        if (4 > reading)
        {
            resultCharset = Charset.forName(EncodingUtils.DEFAULT_ENCODING);
        }
        else
        {
            final long computed = (0xFF000000 & (buffer[0] << 24)) |
                    (0x00FF0000 & (buffer[1] << 16)) |
                    (0x0000FF00 & (buffer[2] << 8)) |
                    (0x000000FF & buffer[3]);
            if (0x0000FEFFL == computed || 0xFFFE0000L == computed)
            {
                resultCharset = Charset.forName("UCS-4");
            }
            else if (0x0000003CL == computed)
            {
                resultCharset = Charset.forName("UCS-4BE");
            }
            else if (0x3C000000L == computed)
            {
                resultCharset = Charset.forName("UCS-4LE");
            }
            else if (0x003C003FL == computed)
            {
                resultCharset = Charset.forName("UTF-16BE");
            }
            else if (0x3C003F00L == computed)
            {
                resultCharset = Charset.forName("UTF-16LE");
            }
            else if (0x3C3F786DL == computed || 0x4C6FA794L == computed)
            {
                resultCharset = EncodingUtils.getXmlCharsetEncoding(buffer);
            }
            else if (0xFEFF0000L == (computed & 0xFFFF0000L))
            {
                resultCharset = Charset.forName("UTF-16");
            }
            else if (0xFFFE0000L == (computed & 0xFFFF0000L))
            {
                resultCharset = Charset.forName("UTF-16");
            }
            else
            {
                resultCharset = Charset.forName(EncodingUtils.DEFAULT_ENCODING);
            }
        }
        return resultCharset;
    }
902106
public Character getCharacterProperty(String key) {
    JsonElement propertyKey = properties().get(key);
    return propertyKey == null ? null : propertyKey.getAsCharacter();
  }