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::Escape::Unicode - Perl extension for Encoding of Unicode Escape Sequnces

SYNOPSIS

  use Encode::Escape::Unicode;

  $escaped = "What is \\x{D384}? It's Perl!";
  $string = decode 'unicode-escape', $escaped;

  # Now, $string is equivalent "What is \x{D384}? It's Perl!"

  Encode::Escape::Unicode->demode('python');

  $python_unicode_escape = "And \\u041f\\u0435\\u0440\\u043b? It's Perl, too";
  $string = decode 'unicode-escape', $python_unicode_escape;

  # Now, $string eq "And \x{041F}\x{0435}\x{0440}\x{043B}? It's Perl, too"

If you have a text data file 'unicode-escape.txt'. It contains a line:

  Perl\tPathologically Eclectic Rubbish Lister\n

And you want to use it as if it were a normal double quote string in source code. Try this:

  open(FILE, 'unicode-escape.txt');
  while(<FILE>) {
    chomp;
    print decode 'unicode-escape', $_;
  }

DESCRIPTION

Encode::Escape::Unicode module implements encodings of escape sequences.

Simply saying, it converts (decodes) escape sequences into Perl internal string (\x{0000} -- \x{ffff}) and vice versa.

See Encode::Escape for more detailed description.

AUTHOR

you, <you at cpan dot org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by you

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.