This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to make XMLPrinter encoding-aware


On 07/27/2012 12:03 PM, ÐÐÐÑÑÐÐ wrote:
Hello!

I've extended XMLPrinter with a field escapeCharsetEncoder ::java.nio.charset.CharsetEncoder and 2 methods:
* method (gnu.xml.XMLPrinter:setEscapeCharset printer charset), accepts string or java.nio.charset.Charset as the 2nd argument
* method (gnu.xml.XMLPrinter:setDefaultEscapeCharset printer), the same as above but uses the system charset

Thanks! Some questions/issues:


* In mustHexEscape, why do you use escapeCharsetEncoder.canEncode(Charsequence)
rather than escapeCharsetEncoder.canEncode(char)? Presumably using the latter
would be less expensive. Perhaps you canEncode(Charsequence) only if (v > 0xFFFF)?


* setEscapeCharset(String charsetName) seems wrong - it doesn't actually use
the charset.
I assume a call to:
  setEscapeCharset(charset)
is missing?

* I notice in setEscapeCharset(Charset charset) you don't actually save the
charset for certain well-known charsets. I guess that's a reasonable optimization,
at the cost of a slight extra complexity, but I have to think about it.
--
--Per Bothner
per@bothner.com http://per.bothner.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]