Author: nscavell
Date: 2011-07-29 17:04:11 -0400 (Fri, 29 Jul 2011)
New Revision: 6958
Modified:
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
Log:
Fix encoding issues.
Modified:
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
===================================================================
---
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29
20:25:44 UTC (rev 6957)
+++
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29
21:04:11 UTC (rev 6958)
@@ -43,7 +43,7 @@
{
public static <N> StaxWriter<N> createWriter(Naming<N> naming,
OutputStream outputStream) throws StaxNavException
{
- return buildDefaultWriter().withOutputStream(outputStream).build(naming);
+ return buildDefaultWriter(outputStream).build(naming);
}
public static StaxWriter<String> createWriter(OutputStream outputStream) throws
StaxNavException
@@ -168,8 +168,14 @@
.withFormatting(createFormatter());
}
+ private static StaxWriterBuilder buildDefaultWriter(OutputStream outputStream)
+ {
+ return buildWriter().withEncoding("UTF-8").withVersion("1.0")
+ .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr",
Boolean.FALSE)
+ .withFormatting(createFormatter())
+ .withOutputStream(outputStream, "UTF-8");
+ }
-
private static final int DEFAULT_INDENT_SIZE = 3;
private static final char DEFAULT_INDENT_CHAR = ' ';
private static final String DEFAULT_NEWLINE;
Modified:
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
===================================================================
---
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29
20:25:44 UTC (rev 6957)
+++
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29
21:04:11 UTC (rev 6958)
@@ -168,7 +168,7 @@
if (output instanceof OutputStream)
{
- if (outputEncoding == null)
+ if (outputEncoding != null)
{
try
{