Package com.hp.hpl.jena.util

Examples of com.hp.hpl.jena.util.CharEncoding$NonIANAnioEncoding


        }
    }

    protected void setEncoding(String original) throws SAXParseException {

        CharEncoding encodingInfo = CharEncoding.create(original);
        String e = encodingInfo.name();
        if (xmlEncoding == null) {
            // special case UTF-8 or UTF-16?
            if (e.equals("UTF") && readerXMLEncoding != null
                    && readerXMLEncoding.startsWith("UTF")) {
                xmlEncoding = readerXMLEncoding;
                return;
            }
            xmlEncoding = e;
            if (readerXMLEncoding != null
                    && !readerXMLEncoding.equalsIgnoreCase(e)) {
                warning(null,
                        WARN_ENCODING_MISMATCH,
                        "Encoding on InputStreamReader or FileReader does not match that of XML document. Use FileInputStream. ["
                                + readerXMLEncoding + " != " + e + "]");
                encodingProblems = true;
            }

            if (e.equals("UTF"))
                return;

            if (!encodingInfo.isIANA()) {
                warning(null,encodingInfo.isInNIO() ? WARN_NON_IANA_ENCODING
                        : WARN_UNSUPPORTED_ENCODING, encodingInfo
                        .warningMessage());
            } else if (!original.equalsIgnoreCase(e)) {
                warning(null,WARN_NONCANONICAL_IANA_NAME, "The encoding \""
                        + original
                        + "\" is not the canonical name at IANA, suggest \""
View Full Code Here


    String decl = null;
    if (out instanceof OutputStreamWriter) {
      String javaEnc = ((OutputStreamWriter) out).getEncoding();
      // System.err.println(javaEnc);
      if (!(javaEnc.equals("UTF8") || javaEnc.equals("UTF-16"))) {
          CharEncoding encodingInfo = CharEncoding.create(javaEnc);
           
        String ianaEnc = encodingInfo.name();
        decl = "<?xml version="+attributeQuoted("1.0")+" encoding=" + attributeQuoted(ianaEnc) + "?>";
        if (!encodingInfo.isIANA())
           logger.warn(encodingInfo.warningMessage()+"\n"+
                    "   It is better to use a FileOutputStream, in place of a FileWriter.");
              
      }
    }
    if (decl == null && showXmlDeclaration != null)
View Full Code Here

    String decl = null;
    if (out instanceof OutputStreamWriter) {
      String javaEnc = ((OutputStreamWriter) out).getEncoding();
      // System.err.println(javaEnc);
      if (!(javaEnc.equals("UTF8") || javaEnc.equals("UTF-16"))) {
          CharEncoding encodingInfo = CharEncoding.create(javaEnc);
           
        String ianaEnc = encodingInfo.name();
        decl = "<?xml version="+attributeQuoted("1.0")+" encoding=" + attributeQuoted(ianaEnc) + "?>";
        if (!encodingInfo.isIANA())
           logger.warn(encodingInfo.warningMessage()+"\n"+
                    "   It is better to use a FileOutputStream, in place of a FileWriter.");
              
      }
    }
    if (decl == null && showXmlDeclaration != null)
View Full Code Here

    String decl = null;
    if (out instanceof OutputStreamWriter) {
      String javaEnc = ((OutputStreamWriter) out).getEncoding();
      // System.err.println(javaEnc);
      if (!(javaEnc.equals("UTF8") || javaEnc.equals("UTF-16"))) {
          CharEncoding encodingInfo = CharEncoding.create(javaEnc);
           
        String ianaEnc = encodingInfo.name();
        decl = "<?xml version="+attributeQuoted("1.0")+" encoding=" + attributeQuoted(ianaEnc) + "?>";
        if (!encodingInfo.isIANA())
           logger.warn(encodingInfo.warningMessage()+"\n"+
                    "   It is better to use a FileOutputStream, in place of a FileWriter.");
              
      }
    }
    if (decl == null && showXmlDeclaration != null)
View Full Code Here

        }
    }

    protected void setEncoding(String original) throws SAXParseException {

        CharEncoding encodingInfo = CharEncoding.create(original);
        String e = encodingInfo.name();
        if (xmlEncoding == null) {
            // special case UTF-8 or UTF-16?
            if (e.equals("UTF") && readerXMLEncoding != null
                    && readerXMLEncoding.startsWith("UTF")) {
                xmlEncoding = readerXMLEncoding;
                return;
            }
            xmlEncoding = e;
            if (readerXMLEncoding != null
                    && !readerXMLEncoding.equalsIgnoreCase(e)) {
                warning(null,
                        WARN_ENCODING_MISMATCH,
                        "Encoding on InputStreamReader or FileReader does not match that of XML document. Use FileInputStream. ["
                                + readerXMLEncoding + " != " + e + "]");
                encodingProblems = true;
            }

            if (e.equals("UTF"))
                return;

            if (!encodingInfo.isIANA()) {
                warning(null,encodingInfo.isInNIO() ? WARN_NON_IANA_ENCODING
                        : WARN_UNSUPPORTED_ENCODING, encodingInfo
                        .warningMessage());
            } else if (!original.equalsIgnoreCase(e)) {
                warning(null,WARN_NONCANONICAL_IANA_NAME, "The encoding \""
                        + original
                        + "\" is not the canonical name at IANA, suggest \""
View Full Code Here

    String decl = null;
    if (out instanceof OutputStreamWriter) {
      String javaEnc = ((OutputStreamWriter) out).getEncoding();
      // System.err.println(javaEnc);
      if (!(javaEnc.equals("UTF8") || javaEnc.equals("UTF-16"))) {
          CharEncoding encodingInfo = CharEncoding.create(javaEnc);
           
        String ianaEnc = encodingInfo.name();
        decl = "<?xml version="+attributeQuoted("1.0")+" encoding=" + attributeQuoted(ianaEnc) + "?>";
        if (!encodingInfo.isIANA())
           logger.warn(encodingInfo.warningMessage()+"\n"+
                    "   It is better to use a FileOutputStream, in place of a FileWriter.");
              
      }
    }
    if (decl == null && showXmlDeclaration != null)
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.util.CharEncoding$NonIANAnioEncoding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.