Helma logo
helma.org » Home > Stories > res.charset

res.charset

Sets the character encoding of the output.

Syntax
res.charset

Sets Helma's character encoding according to the list of supported encodings. By default, Helma uses ISO-8859-1 (western) encoding. It is also possible to set the encoding server or application wide using the charset property in a properties file.

Example
res.charset = "UTF8";
res.write("Ä Ö Ü ä ö ü ß");
// this is displayed if the brower's encoding is set to "Western"
à „ à – à œ à ¤ à ¶ à ¼ à Ÿ


... comment


Page last modified on 2002-07-10 07:57 by tobi

 
rist, Monday, 15. September 2003, 20:08
be careful when setting the charset of a document containing a FORM.
The browser returns the user-input encoded in the same way as the document. So if you set for instance the charest to UTF-8 (and don't set it in the app.properties or server.properties) you'll get scrambled input because Helma assumes the input is encoded in the standard encoding (default is ISO-8859-1). So you have to convert the returned strings from UTF8 to ISO-8859-1 (e.g. var string = new java.lang.String(new java.lang.String((req.data.input ? req.data.input : "")).getBytes("ISO-8859-1"), "UTF-8");).

... link  


... comment