Inspired by Georgios Petasis, I made some tests responding data other
than html.

I use a json return.
The are the commands with different param values and their results:

<?
headers type "application/json;charset=UTF-8"
fconfigure stdout {*}$param
# An Ä and a Bullet (=&Auml;&#2022;)
puts "\"\u00c4\u2022\""
?>

set param                 | Sent data
""                        | iso8859-1 + <lf>
-encoding utf-8           | utf-8 + <lf>
-encoding binary          | "Ä""<lf><space> - very strange
-encoding identity        | utf-8 + <lf><space>
-translation binary       | "Ä""<lf><space> - very strange

So, utf-8 and identity gave good results.
The results with "binary" are quite unexpected. The bullet is translated
to '"'. The "Ä" is coded in iso8859-1.

The following script also gives a good utf-8 result:
<?
headers type "application/json;charset=UTF-8"
fconfigure stdout -translation binary
# An Ä and a Bullet (=&Auml;&#2022;)
puts [encoding convertto utf-8 "\"\u00c4\u2022\""]
?>

I tested it with curl as client.

Here are my questions:

- what is the perfect stdout encoding ?
utf-8 or identity for utf-8 data and binary for binary data (for example
images).

- why is the rivet default not utf-8 as this is ok for xhtml which is
the default data type ?

Enjoy,
Harald

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to