On 11/20/05, Nick Kew <[EMAIL PROTECTED]> wrote: > On Sunday 20 November 2005 14:53, Jeff Trawick wrote: > > On input path, ap_xml_parse_input() handles converting xml to native > > charset (at least in 2.2). On output, there is no provision for > > converting xml in responses. > > Is this a hypothetical or real-life issue?
real-life; although maybe we should try tweaking DAV_XML_CONTENT_TYPE and DAV_XML_HEADER to specify an EBCDIC codepage and see how many DAV clients can handle it (I think this is a mild haha, but maybe the joke is on me ;) ) also, mod_charset_lite could translate the DAV xml already, but it would be unnatural to have to configure that and perhaps impossible to indicate that certain content may have different codesets than the DAV xml > > (b) have DAV implement a filter that converts xml from native to UTF-8 > > (or whatever the xml says the charset is in); add the filter > > automatically within DAV when it generates an xml response; it would > > be prudent for mod_charset_lite to be aware of this filter so that it > > won't touch the body where it is added > > FWIW, libxml2 does that. There's well-tried-and-tested code for > detecting encoding and converting to utf-8 in several of my filters; > for example mod_proxy_html (which is GPL, but I'd have no problem > relicensing the relevant parts for a good cause). > > As regards working with mod_charset_lite, mod_filter dispatching > should deal with that. config based? user could potentially use Limit to inhibit the normal filter on methods where DAV protocol data is returned... with (c), mod_charset_lite is able to say "I have been configured to translate content for this URI, but this is obviously DAV protocol data (since my DAV-specific filter was added) so I should leave this response alone", with no opportunity for misconfiguration... > > (c) have mod_charset_lite implement a special filter for this purpose; > > perhaps it uses the existing logic but the name of the filter sets the > > proper configuration; DAV would add this filter implicitly when it > > generates an xml response; user simply loads mod_charset_lite on > > non-ASCII machine and no further configuration is needed to get DAV > > xml translatable > > Bear in mind that a filter at the charset_lite/iconv level is going to have to > edit the xmldecl and, in the case of (X)HTML, any <meta> element that > sets charset. once mod_dav stops claiming that the xml is utf-8 to start with... this filter would have to get smarter as mod_dav does... > > (c) looks reasonable to me; they agree on filter name > > (mod_charset_lite.h) and it is presumed that it means to translate > > from the codepage of compliled in strings (such as the string > > DAV_XML_HEADER in mod_dav.h) to UTF-8 > > Indeed, subject to the above caveats. Thanks, Jeff
