Skip to content

Commit 006f092

Browse files
committed
Create TestCharset.java
1 parent 2b7ff68 commit 006f092

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}

0 commit comments

Comments
 (0)