Michael Franklin wrote:
So my questions are: 1) In an Apache module, how do you output a std::wstring or wchar_t* to the client as UTF-8?

You would have to ensure it is utf-8, then output it.  Or else
use it with an output filter that converts to utf-8.  But if
you're using 16-bit chars internally, why not output as utf-16?

2)  Does APR have an API designed specifically for this purpose?

apr_xlate should do the job, provided it finds the required to and from
encodings on your platform's iconv (or whatever windows has as an
alternative).

Do any of the charset filter modules - e.g. mod_charset_lite - help?
That should be the easy way.

If it doesn't, I'd start looking at the platform.  Maybe install iconv,
then install apr-* and httpd on top of it.  Apache can't do that for
you because of licensing issues - you have to do it yourself (it's
not an issue for most of us, as iconv is included as standard on
modern OSs).

Either that, or cast a critical eye on whether your wchar stream is
(bytewise) what you think it is.

Reply via email to