Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

Encode

abstract virtual func Encode(text: string) -> Result<Sequence<byte>, EncodingError>

Declaring type: Encoding
Module: System.Text
Assembly: System.Runtime.dll
Source file: Encoding.rvn

Defined by Encoding.Encode · Required implementation (no default).

Interface implementation: Required implementation (no default).

Encodes a complete text value.

Parameters

Name Type Description
text String Valid Unicode text; never interpreted as a UTF-16 buffer.

Return value

Result<Sequence<Byte>, EncodingError>

Encoded bytes, UnrepresentableText, or LimitExceeded.

Remarks

Built-ins accept up to 65536 UTF-8 input bytes. Strict ASCII rejects any non-ASCII scalar; UTF-8 never adds a BOM. No output stream is touched by this operation. Host resource budgets still apply.