Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Unicode::Semantics 1.02

    Download button

    No screenshots available
    Downloads: 268  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Juerd Waalboer | More programs
    Perl Artistic License / FREE
    July 13th, 2009, 17:35 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Unicode::Semantics description

    Work around *the* Perl 5 Unicode bug

    Unicode::Semantics is a workaround for the Perl 5 Unicode bug. Although the internal encoding of a string is hidden from the Perl programmer, it does unfortunately affect semantics. Perl uses Unicode semantics when the internal encoding for a string is UTF8, but it uses ASCII semantics when the internal encoding is ISO-8859-1.

    Because you shouldn't (and often don't) know what the internal encoding will be, it's hard to predict whether these operations will actually do what you want. Unicode::Semantics::us() gives you predictable results for your string.

    Normally, the non-ASCII part of the character set is ignored when for the following operations on a string of which the internal encoding is ISO-8859-1:

     * uc, lc, ucfirst, lcfirst, U, L, u, l
     * d, s, w, D, S, W
     * /.../i, (?i:...)
     * /[[:posix:]]/


    This module exports us that upgrades your string to UTF-8 internally and returns the string. An alias, up, is also exported by default. After initially releasing the module with us, I changed my mind and starting liking up better.

    You can also use the built-in function utf8::upgrade, which upgrades the string and returns the number of octets used for the internal UTF8 buffer.

    Non-string values (like numbers, references, objects, and undef) are stringified on upgrade.

    us, up, and utf8::upgrade mutate the variable's actual value. If you need to upgrade only a copy of a string, make the copy first:

     up(my $copy = $original);

    Upgrading an already upgraded variable does not re-upgrade, so it is safe.

    SYNOPSIS

     $foo; # could be anything
     up $foo; # force Unicode semantics


    or:

     up($foo) =~ s/W/_/g; # Upgrade and use immediately


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Unicode bug | Perl module | Unicode | bug | workaround

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM