An open API service indexing awesome lists of open source software.

https://github.com/dnmfarrell/encode-utf8-slow

A naive UTF-8 encoder/decoder written in Perl
https://github.com/dnmfarrell/encode-utf8-slow

Last synced: 8 months ago
JSON representation

A naive UTF-8 encoder/decoder written in Perl

Awesome Lists containing this project

README

          

=encoding utf8

=head1 NAME

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

=head1 SYNOPSIS

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

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

my $codepoint = bytes_to_codepoint('🗼');

=head1 FUNCTIONS

=head2 codepoint_to_bytes

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

=head2 bytes_to_codepoint

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

=head1 WARNING

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

=head1 SEE ALSO

=over 4

=item *

L for a super fast UTF-8 encoder.

=item *

L my PerlTricks.com article about this code.

=item *

L - which defines the current UTF-8 standard.

=back

=head1 REPOSITORY

This code is hosted at L.

=head1 AUTHOR

E 2016 David Farrell

=head1 LICENSE

FreeBSD, see LICENSE.

=cut