Gets the default encoding. If set by Citrus system property (citrus.file.encoding) use
this one otherwise use system default.
@return
348454
private String getEncoding() {
        return System.getProperty(Citrus.CITRUS_FILE_ENCODING_PROPERTY, System.getenv(Citrus.CITRUS_FILE_ENCODING_ENV) != null ?
                System.getenv(Citrus.CITRUS_FILE_ENCODING_ENV) : Charset.defaultCharset().displayName());
    }
70691
public String getDescriptiveText() {
        String defaultLocale = Locale.getDefault().getLanguage();
        String descriptiveText = getDescriptiveText(defaultLocale);
        if (descriptiveText == null) {
            descriptiveText = getDescriptiveText("en");
            if (descriptiveText == null) {
                descriptiveText = getDescriptiveText("");
            }
        }
        return descriptiveText;
    }
84155
public java.lang.String getCharset() {
        return (java.lang.String) getStateHelper().eval(PropertyKeys.charset);

    }
1258110
protected final Charset getCharset() {
    return mediaType == null || mediaType.getCharsetParameter() == null
        ? Charsets.ISO_8859_1
        : mediaType.getCharsetParameter();
  }
389335
private static int acquireFileEncodingCcsid() {
        // Get the charset represented by file.encoding
        Charset charset = null;
        String fileEncoding = System.getProperty("file.encoding");
        try {
            charset = Charset.forName(fileEncoding);
        } catch (Throwable t) {
            // Problem with the JVM's file.encoding property
        }

        int ccsid = getCcsid(charset);
        if (ccsid == 0) {
            System.err.println(MessageFormat.format(BootstrapConstants.messages.getString("warn.fileEncodingNotFound"), fileEncoding));
        }
        return ccsid;
    }
872995
protected String determineEncoding(ResourceRequest request) {
        String encoding = request.getCharacterEncoding();
        if (encoding == null) {
            encoding = getDefaultEncoding();
        }
        return encoding;
    }
351373
public static EncodingWriter getWriteEncoding(String encoding)
  {
    if (encoding == null)
      encoding = "iso-8859-1";

    EncodingWriter factory = _writeEncodingFactories.get(encoding);

    if (factory != null)
      return factory.create();

    factory = _writeEncodingFactories.get(encoding);

    if (factory == null) {
      try {
        String javaEncoding = Encoding.getJavaName(encoding);

        if (javaEncoding == null)
          javaEncoding = "ISO8859_1";

        String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Writer";

        Class<?> cl = Class.forName(className);

        factory = (EncodingWriter) cl.newInstance();
        factory.setJavaEncoding(javaEncoding);
      } catch (Throwable e) {
      }

      if (factory == null) {
        factory = new JDKWriter();
        String javaEncoding = Encoding.getJavaName(encoding);

        if (javaEncoding == null)
          javaEncoding = "ISO8859_1";
        factory.setJavaEncoding(javaEncoding);
      }

      _writeEncodingFactories.put(encoding, factory);
    }

    // return factory.create(factory.getJavaEncoding());
    // charset uses the original encoding, not the java encoding
    return factory.create(encoding);
  }
1158462
protected String getDefaultString() {
        final StringBuilder outBuilder = new StringBuilder();
        if (!namespace.isEmpty()) {
            outBuilder.append(namespace).append("\n");
        }
        if (!qvarMapVariable.isEmpty() && addQvarMap) {
            outBuilder.append(qvarMapVariable).append("\n");
        }
        outBuilder.append("for $m in ").append(pathToRoot).append(" return\n")
                .append("for $x in $m//*:").append(NonWhitespaceNodeList.getFirstChild(mainElement).getLocalName())
                .append("\n").append(exactMatchXQuery);
        if (!lengthConstraint.isEmpty() || !qvarConstraint.isEmpty()) {
            outBuilder.append("\n").append("where").append("\n");
            if (lengthConstraint.isEmpty()) {
                outBuilder.append(qvarConstraint);
            } else {
                outBuilder.append(lengthConstraint)
                        .append(qvarConstraint.isEmpty() ? "" : "\n and ").append(qvarConstraint);
            }
        }
        outBuilder.append("\n\n").append("return").append("\n").append(returnFormat);
        return outBuilder.toString();
    }
845189
public static Charset getStringEncodingCharset() {
		if (currentStringEncoding == null) {
			final String value = JanusConfig.getSystemProperty(BYTE_ARRAY_STRING_CHARSET_NAME, null);
			if (value != null) {
				try {
					currentStringEncoding = Charset.forName(value);
					if (currentStringEncoding == null) {
						currentStringEncoding = BYTE_ARRAY_STRING_CHARSET_VALUE;
					}
				} catch (Throwable exception) {
					currentStringEncoding = BYTE_ARRAY_STRING_CHARSET_VALUE;
				}
			} else {
				currentStringEncoding = BYTE_ARRAY_STRING_CHARSET_VALUE;
			}
		}
		return currentStringEncoding;
	}
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;
    }
1066069
private static String getEncodingToUse(String encoding)
    {
        //get encoding
        String updatedEncoding=encoding;
        if(updatedEncoding==null)
        {
            updatedEncoding=IOHelper.getDefaultEncoding();
        }
        
        return updatedEncoding;
    }
596312
public static EncodingReader getReadFactory(final String encoding)
    throws UnsupportedEncodingException
  {
    String encKey = encoding == null ? "iso-8859-1" : encoding;

    EncodingReader factory = _readEncodingFactories.get(encKey);

    if (factory == null) {
      try {
        String javaEncoding = Encoding.getJavaName(encoding);

        if (javaEncoding == null)
          javaEncoding = "ISO8859_1";

        String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Reader";

        Class<?> cl = Class.forName(className);

        factory = (EncodingReader) cl.newInstance();
        factory.setJavaEncoding(javaEncoding);
      } catch (Throwable e) {
      }

      if (factory == null) {
        String javaEncoding = Encoding.getJavaName(encoding);

        if (javaEncoding == null)
          javaEncoding = "ISO8859_1";

        factory = new JDKReader();
        factory.setJavaEncoding(javaEncoding);
      }

      _readEncodingFactories.put(encKey, factory);
    }

    return factory;
  }
762482
public static Encoding getJVMEncoding(String jvmEncoding) {
    if ("UTF-8".equals(jvmEncoding)) {
      return new UTF8Encoding();
    }
    if (Charset.isSupported(jvmEncoding)) {
      return new Encoding(jvmEncoding);
    } else {
      return DEFAULT_ENCODING;
    }
  }
908908
public Charset getCharset() {
        String enc = getEncoding();
        if (enc == null) {
            return Charset.defaultCharset();
        } else {
            return Charset.forName(enc);
        }
    }
967158
public String getMnemonic() {
        Opcode opcode = getOpcode();
        if (opcode == null)
            return "bytecode " + getUnsignedByte(0);
        else
            return opcode.toString().toLowerCase(Locale.US);
    }
491745
public static function getEncoding($file = null, $default = 'utf-8') {
		if (!function_exists('finfo_open')) {
			return $default;
		}
		$finfo = finfo_open(FILEINFO_MIME_ENCODING);
		$encoding = finfo_file($finfo, $file);
		finfo_close($finfo);
		if ($encoding !== false) {
			return $encoding;
		}
		return $default;
	}
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");
  }