--- old/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java 2017-03-10 23:56:53.346303091 +0300 +++ new/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java 2017-03-10 23:56:53.250303503 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -436,13 +436,14 @@ if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; + CharacterEscapeHandler ceh = createEscapeHandler(encoding); if(isFormattedOutput()) - out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler); + out = new IndentingUTF8XmlOutput(os, indent, table, ceh); else { if(c14nSupport) - out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler); + out = new C14nXmlOutput(os, table, context.c14nSupport, ceh); else - out = new UTF8XmlOutput(os, table, escapeHandler); + out = new UTF8XmlOutput(os, table, ceh); } if(header!=null) out.setHeader(header);