Subject Author Date
Re: Encoding?, incantation? Stephen R. van den Berg <srb[at]cuci[dot]nl> 09-04-2009
Martin Stjernholm wrote:
>"Stephen R. van den Berg" <<srb[at]>> wrote:

>> I.e. I already verified that the database contains a real 2010 characters
>> binary, at RXML level the variable confirms that it contains that
>> number of characters.  However, as soon is it gets sent to the browser
>> it ends up being around 3045 bytes (most likely an UTF-8 output conversion).

>It looks like you're getting something in id->output_charset. The only
>place I could find after a quick scan is via a <charset out=...> tag
>(which you don't have), and a charset setting in the file system.
>Maybe you can figure out how it gets set.

It turned out to be the latter.  I.e. for this site I'm doing everything UTF-8,
the database is fully UTF-8, and all files are in UTF-8.

This means that the server sets output_charset to utf-8, and the binary
I'm trying to display gets encoded "properly".

The solution appears to be a mere:

<value type="string">
 <emit source=sql scope=o query="SELECT
    (SELECT mimetype FROM objtype ot
      WHERE ot.otid=(uimg(:imid,:language)).otid
      LIMIT 1) AS mimetype"
  <header name="Content-Type" value="&_.mimetype;" />
</value><charset out="iso-8859-1" /><?comment

Is it supposed to be logical that the charset needs to be forced to
iso-8859-1 in order to pass binary data?

I'd expect something like <charset out="none" /> to be more logical.

>> Anybody know the magic <value> incantation to convince Roxen *not* to
>> perform any character conversions on the output prior to transmission?

><value type="string">

>    <header name="Content-Type" value="&_.mimetype;"/>
>    &o.img;


It works.  Why does it work?  It seems to strip all whitespace outside
the entities.
           Stephen R. van den Berg.

The future isn't what it used to be.