File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/ser Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .fasterxml .jackson .dataformat .xml .ser ;
2+
3+ import com .fasterxml .jackson .dataformat .xml .XmlMapper ;
4+ import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
5+
6+ import java .io .IOException ;
7+
8+ public class TestCharset extends XmlTestBase
9+ {
10+ static class StringBean {
11+ public String 象形字 ;
12+ }
13+
14+ public void testBig5 () throws IOException
15+ {
16+ StringBean stringBean = new StringBean ();
17+ stringBean .象形字 = "pictogram" ;
18+ XmlMapper xmlMapper = new XmlMapper ();
19+ xmlMapper .configure (ToXmlGenerator .Feature .WRITE_XML_1_1 , true );
20+ byte [] xml = xmlMapper .writeValueAsBytes (stringBean , "Big5" );
21+ String xmlText = new String (xml , "Big5" );
22+ String expected =
23+ "<?xml version='1.1' encoding='Big5'?><StringBean><象形字>pictogram</象形字></StringBean>" ;
24+ assertEquals (expected , xmlText );
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments