utf8::is_utf8

Indicates with internal storage format is used by a scalar.

USE: Debugging XS modules.

utf8::upgrade

Changes a scalar to use the upgraded string format (if it's not already) without changing the string.

my $s = ...; my $t = $s; utf8::upgrade( $t ); say utf8::is_utf8( $t ) ?1:0; # 1 say $s eq $t ?1:0; # 1

USE: Working around instances of The Unicode Bug.

utf8::downgrade

Changes a scalar to use the downgraded string format (if it's not already) without changing the string. Dies if it can't.

my $s = ...; my $t = $s; utf8::downgrade( $t ); # Might croak say utf8::is_utf8( $t ) ?1:0; # 0 say $s eq $t ?1:0; # 1

USE: Working around instances of The Unicode Bug.

utf8::encode

Encodes a string using utf8.

Expects a string of arbitrary characters in either storage format.

Produces a string of 8-bit characters in the downgraded format.

USE: You should probably be encoding using the standard UTF-8 encoding instead of the Perl-specific utf8 encoding.

utf8::decode

Decodes a string encoded using utf8. Dies if it can't.

Expects a string of 8-bit characters in either storage format.

Produces a string of characters in the upgraded format.

USE: utf8 is a Perl-specific encoding. Are sure the text isn't encode using the standard UTF-8 encoding?

Encode::is_utf8

Indicates with internal storage format is used by a scalar.

USE: You might as well use the equivalent built-in utf8::is_utf8.

Encode::_utf8_on

Mostly equivalent to the following:

utf8::decode( $_ ) if !utf8::is_utf8( $_ );

The difference is that it produces a corrupt scalar if the string isn't valid utf8.

USE: Do not use as it introduces The Unicode Bug.

Encode::_utf8_off

Equivalent to the following:

utf8::encode( $_ ) if utf8::is_utf8( $_ );

USE: Do not use as it introduces The Unicode Bug.


In reply to Re^2: Seeking Perl docs about how UTF8 flag propagates by ikegami
in thread Seeking Perl docs about how UTF8 flag propagates by raygun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.