The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Encode::UTF8::Slow - A pure Perl, naive UTF-8 encoder/decoder

SYNOPSIS

  use Encode::UTF8::Slow qw/bytes_to_codepoint codepoint_to_bytes/;

  my $bytes = codepoint_to_bytes(0x1F4FA); #television

  my $codepoint = bytes_to_codepoint('🗼');

FUNCTIONS

codepoint_to_bytes

Takes a Unicode codepoint number and returns a scalar of UTF-8 encoded bytes for it. Exported on request.

bytes_to_codepoint

Takes UTF-8 encoded bytes in a scalar and returns the Unicode codepoint for it. Exported on request.

WARNING

This is a naive encoder - it doesn't handle UTF-16 pairs, BOM or other noncharacters like 0xFFFE. It's also very slow!

SEE ALSO

REPOSITORY

This code is hosted at GitHub.

AUTHOR

© 2016 David Farrell

LICENSE

FreeBSD, see LICENSE.