REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 3-Aug-2010 Edit History |
Translates UTF-8 binary source to values. Returns [value binary].
Arguments:
source [binary!] - Must be Unicode UTF-8 encoded
Refinements:
/next - Translate next complete value (blocks as single value)
/only - Translate only a single value (blocks dissected)
/error - Do not throw errors - return error object as value
See also:
The transcode function translates source code and data into the block value memory format that can be interpreted by REBOL.
The source input to transcode must be Unicode UTF-8. This is a binary! encoded format, and should not be confused with a string!, which is a decoded in-memory indexable string.
If you need to transcode a string, you must convert it to a UTF-8 binary first. This can be done with to-binary.
data: transcode to-binary string
Without refinements, transcode will convert the entire input string.
Refinements are provided for partial translation:
/next | Translate the next full value. If it is a block, translate the entire block. |
/only | Translate the next singular value. If it is a block, translate only the first element of the block, and return it within a block. |
/error | Convert syntax errors to error objects and output them rather than throwing them as an error. |
These refinements can be used in various ways to parse REBOL source a value at a time.
The output from transcode is a block! containing two values:
For example:
a: to-binary "a b c"
#{6120622063}
transcode/only a
[a #{20622063}]
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |