docs.roxen.comBack to normal mode
DocsRoxenWebServer 6.1Web Developer ManualText Tags
Copyright © 2021, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com

<recode></recode>

Provided by module: Tags: RXML tags

Converts between character sets. The tag can be used both to decode texts encoded in strange character encoding schemas, and encode internal data to a specified encoding scheme. All character sets listed in RFC 1345 are supported.


Attributes

from="Character set"

Converts the contents of the charset tag from the character set indicated by this attribute to the internal text representation. Useful for decoding data stored in a database. The special character set called "safe-utf8" will try to decode utf8, and silently revert back in case the content is not valid utf8 (for example iso-8859-1); this is useful when the content is not always valid utf8.


to="Character set"

Converts the contents of the charset tag from the internal representation to the character set indicated by this attribute. Useful for encoding data before storing it into a database.

Any characters that cannot be represented in the selected encoding will generate a run-time error unless the entity-fallback or string-fallback attributes are provided.


string-fallback="string"

Only applicable together with the to attribute. This string will be used for characters falling outside the target encoding instead of generating a run-time error.

This example shows the HTML output for 7-bit US ASCII encoding which cannot represent the Swedish ö character:

<p><recode to='ASCII' string-fallback='?'>Björn Borg</recode></p>
In the output source code, this would look like:
<p>Bj?rn Borg</p>

entity-fallback="{yes, no}"

Only applicable together with the to attribute. Default is no, but if set to yes any characters falling outside the target encoding will be output as numerical HTML entities instead of generating a run-time error. If both this and string-fallback are used at the same time this attribute will take precedence.

This example shows the HTML output for 7-bit US ASCII encoding which cannot represent the Swedish ö character:

<p><recode to='ASCII' entity-fallback='yes'>Björn Borg</recode></p>
In the output source code, this would look like:
<p>Bj&#246;rn Borg</p>