Project

Profile

Help

Revision 66bcb14f

Added by Michael Kay over 12 years ago

2775998 - byte-order-mark with method="text"

View differences:

latest9.1/bj/net/sf/saxon/event/TEXTEmitter.java
27 27
            characterSet = UnicodeCharacterSet.getInstance();
28 28
        }
29 29
        // Write a BOM if requested
30
        String encoding = outputProperties.getProperty(OutputKeys.ENCODING);
31
        if (encoding==null || encoding.equalsIgnoreCase("utf8")) {
32
            encoding = "UTF-8";
33
        }
30 34
        String byteOrderMark = outputProperties.getProperty(SaxonOutputKeys.BYTE_ORDER_MARK);
31 35

  
32
        if ("yes".equals(byteOrderMark) &&
33
                    "UTF-8".equalsIgnoreCase(outputProperties.getProperty(OutputKeys.ENCODING))) {
36
        if ("yes".equals(byteOrderMark) && (
37
                "UTF-8".equalsIgnoreCase(encoding) ||
38
                    "UTF-16LE".equalsIgnoreCase(encoding) ||
39
                    "UTF-16BE".equalsIgnoreCase(encoding))) {
34 40
            try {
35 41
                writer.write('\uFEFF');
36 42
                empty = false;

Also available in: Unified diff