package utf8;
use strict;
use warnings;
our $hint_bits = 0x00800000;
our $VERSION = '1.25';
our $AUTOLOAD;
sub import {
$^H |= $hint_bits;
}
sub unimport {
$^H &= ~$hint_bits;
}
sub AUTOLOAD {
goto &$AUTOLOAD if defined &$AUTOLOAD;
require Carp;
Carp::croak("Undefined subroutine $AUTOLOAD called");
}
1;
__END__
=head1 NAME
utf8 - Perl pragma to enable/disable UTF-8 (or UTF-EBCDIC) in source code
=head1 SYNOPSIS
use utf8;
no utf8;
# Convert the internal representation of a Perl scalar to/from UTF-8.
$num_octets = utf8::upgrade($string);
$success = utf8::downgrade($string[, $fail_ok]);
# Change each character of a Perl scalar to/from a series of
# characters that represent the UTF-8 bytes of each original character.
utf8::encode($string); # "\x{100}" becomes "\xc4\x80"
utf8::decode($string); # "\xc4\x80" becomes "\x{100}"
# Convert a code point from the platform native character set to
# Unicode, and vice-versa.
$unicode = utf8::native_to_unicode(ord('A')); # returns 65 on both
# ASCII and EBCDIC
# platforms
$native = utf8::unicode_to_native(65); # returns 65 on ASCII
# platforms; 193 on
# EBCDIC
$flag = utf8::is_utf8($string); # since Perl 5.8.1
$flag = utf8::valid($string);
=head1 DESCRIPTION
The C