Encode
Native Rust implementation built into the interpreter. Runtime: P5. See original documentation for the full Perl reference.
Functions
decode
Decode byte string from the given encoding to Unicode string.
Mirrors Encode::decode() from Encode.xs. Input bytes without SVF_UTF8 → output string with SVF_UTF8.
decode_utf8
Shorthand for decode(‘UTF-8’, $bytes). Returns character string (SVF_UTF8 set).
encode
Encode Unicode string to byte string in the given encoding.
Mirrors Encode::encode() from Encode.xs. Input string with SVF_UTF8 → output bytes without SVF_UTF8.
encode_utf8
Shorthand for encode(‘UTF-8’, $string). Returns byte string (no SVF_UTF8).
encodings
Returns list of available encoding names.
fb_croak
1
fb_default
fb_htmlcref
0x0208 = 520
fb_perlqq
0x0108 = 264
fb_quiet
4
fb_warn
6
fb_xmlcref
0x0408 = 1032
find_encoding
Returns a blessed hashref {Name => $canonical} or undef if unknown.
perl5: Encode::find_encoding returns an Encode::XS or Encode::utf8 object. We return a blessed HV with a “Name” key, mirroring perl5’s object.
from_to
Convert $octets in-place from $from encoding to $to encoding. Returns length of the converted string, or undef on failure.
perl5: Encode::from_to in Encode.pm calls encode/decode. In the p5 runtime we modify the SV’s PV buffer in-place.
import
called by use Encode qw(...).
No-op in p5 runtime: the builder resolves imported names at compile time.
is_utf8
Returns true if the SV has the SVF_UTF8 flag set.
perl5: Encode.xs:pp_utf8_on checks SvUTF8(sv). This checks the actual flag, not the string content.
leave_src
8
preamble
resolve_alias
Returns the canonical encoding name, or undef if unknown.
utf8_off
Clear SVF_UTF8 on the passed-in SV in-place.
perl5: Encode.xs XSUB _utf8_off: SvUTF8_off(sv).
utf8_on
Set SVF_UTF8 on the passed-in SV in-place.
perl5: Encode.xs XSUB _utf8_on: SvUTF8_on(sv).