wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/DocType.java
@Override
    public String toHtmlString(final Charset charset) {
        final Charset previousCharset = super.getCharset();
        try {
            super.setCharset(charset);
            if (prependDocType) {
                // assigning it to new variable is very important here as this
                // line of code should invoke before finally block
                final String htmlString = new String(
                        (super.toHtmlString(super.getCharset()))
                                .getBytes(super.getCharset()),
                        getCharset());
                return htmlString;
            }

            // assigning it to new variable is very important here as this line
            // of code should invoke before finally block
            final String htmlString = super.toHtmlString(super.getCharset());
            return htmlString;
        } finally {
            super.setCharset(previousCharset);
        }
    }
@Override
    public String toHtmlString(final Charset charset) {
        final Charset previousCharset = super.getCharset();
        try {
            super.setCharset(charset);
            if (prependDocType) {
                // assigning it to new variable is very important here as this
                // line of code should invoke before finally block
                final String htmlString = new String(
                        (super.toHtmlString(super.getCharset()))
                                .getBytes(super.getCharset()),
                        getCharset());
                return htmlString;
            }

            // assigning it to new variable is very important here as this line
            // of code should invoke before finally block
            final String htmlString = super.toHtmlString(super.getCharset());
            return htmlString;
        } finally {
            super.setCharset(previousCharset);
        }
    }
/*
(non-Javadoc)

@see
com.webfirmframework.wffweb.tag.html.AbstractHtml#toHtmlString(java.nio.
charset.Charset)