コード例 #1
0
  public void setEncoding(String encoding) {
    if (encoding == null) {
      return;
    }
    setStringProperty(ENCODING_PROPERTY, encoding);

    if (getStringProperty(LOCAL_ENCODING_PROPERTY) != null) {
      return;
    }

    final EncodingDefinition encodingDefinition =
        EncodingFactory.getPlatformDefault().getEncodingDefinitionByFirebirdName(encoding);
    if (encodingDefinition != null && !encodingDefinition.isInformationOnly()) {
      setStringProperty(LOCAL_ENCODING_PROPERTY, encodingDefinition.getJavaEncodingName());
    }
  }
コード例 #2
0
  public void setCharSet(String charSet) {
    if (charSet == null) {
      return;
    }

    // Normalize the name of the encoding
    final EncodingDefinition encodingDefinition =
        EncodingFactory.getPlatformDefault().getEncodingDefinitionByCharsetAlias(charSet);
    if (encodingDefinition == null) {
      return;
    }
    setStringProperty(LOCAL_ENCODING_PROPERTY, encodingDefinition.getJavaEncodingName());

    if (getStringProperty(ENCODING_PROPERTY) != null) {
      return;
    }

    String encoding = encodingDefinition.getFirebirdEncodingName();
    if (encoding != null) {
      setStringProperty(ENCODING_PROPERTY, encoding);
    }
  }