Result:
found more than 948 distributions - search limited to the first 2001 files matching your query ( run in 0.674 )


Email-Barcode-Decode

 view release on metacpan or  search on metacpan

lib/Email/Barcode/Decode.pm  view on Meta::CPAN

203
204
205
206
207
208
209
210
211
212
213
my $ebd = Email::Barcode::Decode->new(email => $msg);
my @symbols = $ebd->get_symbols;
foreach my $symbol (@symbols) {
    print(
        'decoded '  . $symbol->{type} .
        ' symbol "' . $symbol->{data} .'"'.
        ' file "'   . $symbol->{filename} .'"'.
        "\n"
    );
}

 view all matches for this distribution


Email-MIME-CreateHTML

 view release on metacpan or  search on metacpan

t/UTF-8_html.t  view on Meta::CPAN

15
16
17
18
19
20
21
22
23
24
25
binmode $builder->failure_output, ":encoding(UTF-8)";
binmode $builder->todo_output,    ":encoding(UTF-8)";
 
my $response = LWP::UserAgent->new->get("file://$Bin/data/UTF-8.html");
 
my $body = $response->decoded_content;
 
my $from = generate_address('Föö', 'test@foo.example');
my $to   = generate_address('Bäz', 'test@baz.example');
 
my $subject = encode_mimeword(encode_utf8('Sübject'), 'Q', 'UTF-8');

 view all matches for this distribution


Email-MIME-Encodings

 view release on metacpan or  search on metacpan

lib/Email/MIME/Encodings.pm  view on Meta::CPAN

64
65
66
67
68
69
70
71
72
73
74
#pod =head1 SYNOPSIS
#pod
#pod   use Email::MIME::Encodings;
#pod   my $encoded = Email::MIME::Encodings::encode(base64 => $body);
#pod   my $decoded = Email::MIME::Encodings::decode(base64 => $encoded);
#pod
#pod If a third argument is given, it is the encoding to which to fall back.  If no
#pod valid codec can be found (considering both the first and third arguments) then
#pod an exception is raised.
#pod

lib/Email/MIME/Encodings.pm  view on Meta::CPAN

96
97
98
99
100
101
102
103
104
105
=head1 SYNOPSIS
 
  use Email::MIME::Encodings;
  my $encoded = Email::MIME::Encodings::encode(base64 => $body);
  my $decoded = Email::MIME::Encodings::decode(base64 => $encoded);
 
If a third argument is given, it is the encoding to which to fall back.  If no
valid codec can be found (considering both the first and third arguments) then
an exception is raised.

 view all matches for this distribution


Email-MIME-Kit-Assembler-Markdown

 view release on metacpan or  search on metacpan

lib/Email/MIME/Kit/Assembler/Markdown.pm  view on Meta::CPAN

177
178
179
180
181
182
183
184
185
186
187
}
 
sub assemble {
  my ($self, $stash) = @_;
 
  my $markdown  = ${ $self->kit->get_decoded_kit_entry( $self->path ) };
  my $plaintext = $markdown;
 
 
  if ($self->renderer) {
    {

lib/Email/MIME/Kit/Assembler/Markdown.pm  view on Meta::CPAN

223
224
225
226
227
228
229
230
231
232
233
for my $type (keys %content) {
  my $type_wrapper = "$type\_wrapper";
 
  if (my $wrapper_path = $self->$type_wrapper) {
    my $wrapper = ${ $self->kit->get_decoded_kit_entry($wrapper_path) };
 
    if ($self->render_wrapper) {
      local $stash->{wrapped_content} = $content{$type};
      local $stash->{part_type}       = $type;
      my $output_ref = $self->renderer->render(\$wrapper, $stash);

 view all matches for this distribution


Email-MIME-Kit

 view release on metacpan or  search on metacpan

lib/Email/MIME/Kit.pm  view on Meta::CPAN

90
91
92
93
94
95
96
97
98
99
100
#pod render, and so on.  This, further, means that strings passed to the C<assemble>
#pod method for use in rendering should also be text strings.
#pod
#pod In older versions of Email::MIME::Kit, files read from disk were read in raw
#pod mode and then handled as octet strings.  Meanwhile, the manifest's contents
#pod (and, thus, any templates stored as strings in the manifest) were decoded into
#pod text strings.  This could lead to serious problems.  For example: the
#pod F<manifest.json> file might contain:
#pod
#pod   "header": [
#pod     { "Subject": "Message for [% customer_name %]" },

lib/Email/MIME/Kit.pm  view on Meta::CPAN

120
121
122
123
124
125
126
127
128
129
has manifest => (reader => 'manifest', writer => '_set_manifest');
 
my @auto_attrs = (
  [ manifest_reader => ManifestReader => JSON => [ 'read_manifest' ] ],
  [ kit_reader      => KitReader      => Dir  => [ 'get_kit_entry',
                                                   'get_decoded_kit_entry' ] ],
);
 
for my $tuple (@auto_attrs) {
  my ($attr, $role, $default, $handles) = @$tuple;

lib/Email/MIME/Kit.pm  view on Meta::CPAN

389
390
391
392
393
394
395
396
397
398
399
render, and so on.  This, further, means that strings passed to the C<assemble>
method for use in rendering should also be text strings.
 
In older versions of Email::MIME::Kit, files read from disk were read in raw
mode and then handled as octet strings.  Meanwhile, the manifest's contents
(and, thus, any templates stored as strings in the manifest) were decoded into
text strings.  This could lead to serious problems.  For example: the
F<manifest.json> file might contain:
 
  "header": [
    { "Subject": "Message for [% customer_name %]" },

 view all matches for this distribution


Email-MIME-MobileJP

 view release on metacpan or  search on metacpan

t/01_parse.t  view on Meta::CPAN

25
26
27
28
29
30
31
32
33
34
35
my $mail = Email::MIME::MobileJP::Parser->new($src->as_string);
 
subtest 'subject' => sub {
    is $mail->subject(), 'コンニチワ';
    ok Encode::is_utf8($mail->subject), 'decoded';
};
 
subtest 'carrier' => sub {
    isa_ok $mail->carrier, 'Email::Address::JP::Mobile::DoCoMo';
    is $mail->carrier->name, 'DoCoMo';

 view all matches for this distribution


Email-MIME-RFC2047

 view release on metacpan or  search on metacpan

t/decode.t  view on Meta::CPAN

57
58
59
60
61
62
63
64
);
 
for (my $i=0; $i<@tests; $i+=2) {
    my ($encoded, $expect) = ($tests[$i], $tests[$i+1]);
 
    my $decoded = $decoder->decode_phrase($encoded);
    is($decoded, $expect, "decode_phrase $encoded");
}

 view all matches for this distribution


Email-MIME-XMTP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

13
14
15
16
17
18
19
20
21
22
23
          Content-Type header; it is now default to UTF-8.
 
0.40    Thu Aug 18 17:53:06 CEST 2005
 
        - fixed nusty bug when serializing to XML headers combined with body. Make
          sure that headers as decoded and body is a valid UTF-8 string into XML.
 
0.39    Thu Aug 18 01:44:46 CEST 2005
 
        - fixed bug when Content-Type is not specified; and default to text/plain
          (and do not base64-encode body text)

 view all matches for this distribution


Email-MIME

 view release on metacpan or  search on metacpan

lib/Email/MIME.pm  view on Meta::CPAN

32
33
34
35
36
37
38
39
40
41
42
43
#pod
#pod   use Email::MIME;
#pod   my $parsed = Email::MIME->new($message);
#pod
#pod   my @parts = $parsed->parts; # These will be Email::MIME objects, too.
#pod   my $decoded = $parsed->body;
#pod   my $non_decoded = $parsed->body_raw;
#pod
#pod   my $content_type = $parsed->content_type;
#pod
#pod ...or...
#pod

lib/Email/MIME.pm  view on Meta::CPAN

109
110
111
112
113
114
115
116
117
118
119
#pod =head1 DESCRIPTION
#pod
#pod This is an extension of the L<Email::Simple> module, to handle MIME
#pod encoded messages. It takes a message as a string, splits it up into its
#pod constituent parts, and allows you access to various parts of the
#pod message. Headers are decoded from MIME encoding.
#pod
#pod =head1 METHODS
#pod
#pod Please see L<Email::Simple> for the base set of methods. It won't take
#pod very long. Added to that, you have:

lib/Email/MIME.pm  view on Meta::CPAN

953
954
955
956
957
958
959
960
961
962
963
  use Email::MIME;
  my $parsed = Email::MIME->new($message);
 
  my @parts = $parsed->parts; # These will be Email::MIME objects, too.
  my $decoded = $parsed->body;
  my $non_decoded = $parsed->body_raw;
 
  my $content_type = $parsed->content_type;
 
...or...

lib/Email/MIME.pm  view on Meta::CPAN

1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
=head1 DESCRIPTION
 
This is an extension of the L<Email::Simple> module, to handle MIME
encoded messages. It takes a message as a string, splits it up into its
constituent parts, and allows you access to various parts of the
message. Headers are decoded from MIME encoding.
 
=head1 PERL VERSION
 
This library should run on perls released even a long time ago.  It should
work on any version of perl released in the last five years.

lib/Email/MIME.pm  view on Meta::CPAN

1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
=head2 header_str_pairs
 
  my @pairs = $email->header_str_pairs;
 
This method behaves like C<header_raw_pairs>, returning a list of field
name/value pairs, but the values have been decoded to character strings, when
possible.
 
=head2 header_as_obj
 
  my $first_obj = $email->header_as_obj($field);

lib/Email/MIME.pm  view on Meta::CPAN

1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
#pod =method header_str_pairs
#pod
#pod   my @pairs = $email->header_str_pairs;
#pod
#pod This method behaves like C<header_raw_pairs>, returning a list of field
#pod name/value pairs, but the values have been decoded to character strings, when
#pod possible.
#pod
#pod =method header_as_obj
#pod
#pod   my $first_obj = $email->header_as_obj($field);

 view all matches for this distribution


Email-Outlook-Message

 view release on metacpan or  search on metacpan

lib/Email/Outlook/Message.pm  view on Meta::CPAN

405
406
407
408
409
410
411
412
413
414
415
sub _create_mime_plain_body {
  my $self = shift;
  my $charset = $self->_body_plain_character_set;
  my $body_str = $self->{BODY_PLAIN};
  if ($charset ne "UTF-8") {
    # In this case, the body is a string of octets and needs to be decoded.
    $body_str = Encode::decode($charset, $body_str);
  }
  return Email::MIME->create(
    attributes => {
      content_type => "text/plain",

 view all matches for this distribution


Email-Simple

 view release on metacpan or  search on metacpan

lib/Email/Simple/Header.pm  view on Meta::CPAN

187
188
189
190
191
192
193
194
195
196
#pod
#pod =method header
#pod
#pod This method just calls C<header_raw>.  It's the older name for C<header_raw>,
#pod but it can be a problem because L<Email::MIME>, a subclass of Email::Simple,
#pod makes C<header> return the header's decoded value.
#pod
#pod =cut
 
sub _str_value { return ref $_[0] ? $_[0][0] : $_[0] }

lib/Email/Simple/Header.pm  view on Meta::CPAN

553
554
555
556
557
558
559
560
561
562
=head2 header
 
This method just calls C<header_raw>.  It's the older name for C<header_raw>,
but it can be a problem because L<Email::MIME>, a subclass of Email::Simple,
makes C<header> return the header's decoded value.
 
=head2 header_raw_set
 
  $header->header_raw_set($field => @values);

 view all matches for this distribution


Email-Stuffer-TestLinks

 view release on metacpan or  search on metacpan

lib/Email/Stuffer/TestLinks.pm  view on Meta::CPAN

71
72
73
74
75
76
77
78
79
80
my $response = shift;
 
return Future->fail("Response code was " . $response->code) if ($response->code !~ /^2\d\d/);
 
if ($response->content_type eq 'text/html') {
    my $dom = Mojo::DOM->new($response->decoded_content);
    if (my $title = $dom->at('title')) {
        return Future->fail("Page title contains text '$1'") if $title->text =~ /(error|not found)/i;
    }
}

 view all matches for this distribution


Embperl

 view release on metacpan or  search on metacpan

Changes.pod  view on Meta::CPAN

1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
     automaticly set status to 301.
   - setting http headers and <META HTTP-EQUIV=..> now works also
     in cgi mode.
   - Session Handling now also works in CGI mode (needs
     Apache::Session >= 1.04)
   - ACTION attribute of Formtag is now URL en/decoded. Spotted by
     Hartmut Palm.
 
=head1 1.2b9 (BETA) 10. Sept 1999
 
   - Fixed a problem with loading Apache::Session 1.01, when

 view all matches for this distribution


Emoji-NationalFlag

 view release on metacpan or  search on metacpan

lib/Emoji/NationalFlag.pm  view on Meta::CPAN

60
61
62
63
64
65
66
67
68
69
=head2 code2flag($iso_3166_1_alpha_2_code): Optional[NationalFlagEmoji]
 
This method returns national flag emoji if the supplied code (case insensitive) is valid, otherwise returns C<undef>
 
=head2 flag2code($decoded_national_flag_emoji): Optional[lc(CountryCodeAlpha-2)]
 
This method returns lower case of ISO 3166-1 alpha-2 country code if the supplied emoji is valid, otherwise returns C<undef>
 
=head1 AUTHOR

 view all matches for this distribution


Encode-Argv

 view release on metacpan or  search on metacpan

lib/Encode/Argv.pm  view on Meta::CPAN

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Encode::Argv - Automatically Mess With @ARGV's Encoding
 
=head1 SYNOPSIS
 
  use Encode::Argv ('cp932');
  # Now @ARGV is decoded unicode characters, decoded from cp932
 
  use Encode::Argv ('cp932' => 'euc-jp');
  # Now @ARGV is encoded into euc-jp after being decoded from cp932
 
  use Encode::Argv;
  # Now @ARGV is decoded from whatever Term::Encoding thinks you are
  # using on your terminal.
 
=head1 DESCRIPTION
 
I saw L<http://search.cpan.org/dist/Sjis|Sjis.pm> and L<http://www.aritia.org/hizumi/perl/perlwin.html|this>, and thought, "Well, I can't fix /all/ of their

 view all matches for this distribution


Encode-Base32-Crockford

 view release on metacpan or  search on metacpan

lib/Encode/Base32/Crockford.pm  view on Meta::CPAN

165
166
167
168
169
170
171
172
173
174
175
or
 
    use Encode::Base32::Crockford qw(base32_decode); # your choice of methods
     
    my $decoded = base32_decode_with_checksum("16JD");
    my $encoded = base32_encode_with_checksum(1234);
 
=head1 METHODS
 
=head2 base32_encode

 view all matches for this distribution


Encode-Base32-GMP

 view release on metacpan or  search on metacpan

lib/Encode/Base32/GMP.pm  view on Meta::CPAN

171
172
173
174
175
176
177
178
179
180
181
  base32hex: [0123456789ABCDEFGHIJKLMNOPQRSTUV]
  gmp:       [0123456789ABCDEFGHIJKLMNOPQRSTUV]
 
The encode_base32, decode_base32 and md5_base32 methods support an alphabet
parameter which can be set to the supported alphabets to indicate the value
to be encoded or decoded:
 
  [qw/crockford rfc4648 base32hex zbase32 gmp/]
 
This module functions similarly to L<Encode::Base58::GMP> with Base32 being
ideal for case-insensitive encoding and Base58 being ideal for case-sensitive

 view all matches for this distribution


Encode-Base58-BigInt

 view release on metacpan or  search on metacpan

lib/Encode/Base58/BigInt.pm  view on Meta::CPAN

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
sub decode_base58 {
    my $str = shift;
    $str =~ tr/0OlI/DD11/;
    $str =~ $reg or croak "Invalid Base58";
 
    my $decoded = Math::BigInt->new(0);
    my $multi   = Math::BigInt->new(1);
    my $base    = @$chars;
 
    while (length $str > 0) {
        my $digit = chop $str;
        $decoded->badd($multi->copy->bmul($map->{$digit}));
        $multi->bmul($base);
    }
 
    "$decoded";
}
 
1;
__END__

lib/Encode/Base58/BigInt.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
=head1 SYNOPSIS
 
  use Encode::Base58::BigInt;
  my $bigint  = '9235113611380768826';
  my $encoded = encode_base58($bigint);
  my $decoded = decode_base58($short); # decoded is bigint string
 
 
=head1 DESCRIPTION
 
Encode::Base58::BigInt is a base58 encoder/decoder implementation in Perl.

 view all matches for this distribution


Encode-Base58-GMP

 view release on metacpan or  search on metacpan

lib/Encode/Base58/GMP.pm  view on Meta::CPAN

147
148
149
150
151
152
153
154
155
156
GMP Alphabet: [0-9A-Za-v]
 
The encode_base58, decode_base58 and md5_base58 methods support an alphabet
parameter which can be set to the supported alphabets ['bitcoin', 'flickr',
'gmp'] to indicate the value to be encoded or decoded.
 
=head2 Requirements
 
This module requires GMP 4.2.0 and above. Prior versions are limited to Base36.

 view all matches for this distribution


Encode-Base58

 view release on metacpan or  search on metacpan

lib/Encode/Base58.pm  view on Meta::CPAN

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
}
 
sub decode_base58 {
    my $str = shift;
 
    my $decoded = 0;
    my $multi   = 1;
    my $base    = @alpha;
 
    while (length $str > 0) {
        my $digit = chop $str;
        $decoded += $multi * $alpha{$digit};
        $multi   *= $base;
    }
 
    return $decoded;
}
 
1;
__END__

 view all matches for this distribution


Encode-Bootstring

 view release on metacpan or  search on metacpan

t/encodedecode.t  view on Meta::CPAN

10
11
12
13
14
15
my $BS = new Encode::Bootstring();
my $raw = 'Búlgarska';
my $enc = $BS->encode( $raw );
my $dec = $BS->decode( $enc );
ok( $enc ne $dec, 'not encoded' );
ok( $dec eq $raw, 'decoded same as original' );

 view all matches for this distribution


Encode-Detect

 view release on metacpan or  search on metacpan

Detect.pm  view on Meta::CPAN

50
51
52
53
54
55
56
57
58
59
60
61
62
sub decode ($$;$) {
    my ($self, $octets, $check) = @_;
    my $charset = detect($octets) || 'Windows-1252';
    my $e = find_encoding($charset) or die "Unknown encoding: $charset";
    my $decoded = $e->decode($octets, $check || 0);
    $_[1] = $octets if $check;
    return $decoded;
}
 
1;
 
__END__

 view all matches for this distribution


Encode-Escape

 view release on metacpan or  search on metacpan

t/Encode-Escape-ASCII.t  view on Meta::CPAN

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$string = "\a\b\e\f\n\r\t\\\"\$\@";
$escaped = "\\a\\b\\e\\f\\n\\r\\t\\\\\\\"\\\$\\\@";
 
is      $string,
        (decode 'ascii-escape', $escaped),
        'decoded character escape sequences';
is      $escaped,
        (encode 'ascii-escape', $string),
        'encoded character escape sequences';
 
$string_oct = "\0\00\000\11\011\100";
$escaped_oct = "\\0\\00\\000\\11\\011\\100";
 
is      $string_oct,
        (decode 'ascii-escape', $escaped_oct),
        'decoded octal escape sequences';
 
$string_hex = "\x09\x47\x57\x67\x77";
$escaped_hex = "\\x09\\x47\\x57\\x67\\x77";
 
is      $string_hex,
        (decode 'ascii-escape', $escaped_hex),
        'decoded hex escape sequences';
 
$string_non_printing
        = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e" .
          "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e" .
          "\x7f";

t/Encode-Escape-ASCII.t  view on Meta::CPAN

49
50
51
52
53
54
55
56
57
      "\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\e\\x1c\\x1d\\x1e" .
          "\\x7f";
 
is $string_non_printing,
        (decode 'ascii-escape', $escaped_non_printing),
        'decoded non-printing characters';
is $escaped_non_printing,
        (encode 'ascii-escape', $string_non_printing),
        'encoded non-printing characters';

 view all matches for this distribution


Encode-Float

 view release on metacpan or  search on metacpan

lib/Encode/Float.pm  view on Meta::CPAN

27
28
29
30
31
32
33
34
35
36
37
38
39
for (my $i = 0 ; $i < 10 ; $i++)
{
  my $float = (.5 - rand) * 10**int(10 - 20 * rand);
  $float = 0 if $i == 0;
  my $encoded = $encoder->encode($float);
  my $decoded = $encoder->decode($encoded);
  my $error   = $encoder->getRelativeDifference($float, $decoded);
  push @list, [ $encoded, $float, $decoded, $error ];
}
@list = sort { $a->[0] cmp $b->[0] } @list;
foreach (@list)
{
  print join(',', @$_) . "\n";

 view all matches for this distribution


Encode-Korean

 view release on metacpan or  search on metacpan

t/Encode-Korean-HSR.t  view on Meta::CPAN

83
84
85
86
87
88
89
90
91
92
93
94
95
96
                          "anj.a anja " .
                          "anj.ja anjja " .
                          "anjjja" ;
         
my $encoded_ccs = encode 'hsr', $str_ccs;
my $decoded_ccs = decode 'hsr', $hsr_ccs;
my $decoded_ccs_smart_sep = decode 'hsr', $hsr_ccs_smart_sep;
 
is $encoded_ccs, $hsr_ccs, 'encoded complex consonants group';
is $decoded_ccs, $str_ccs, 'decoded complex consonants group';
is $decoded_ccs_smart_sep, $str_ccs, 'decoded complex consonants group with smart sep';
 
is $encoded_ccs, (encode 'hsr', $decoded_ccs), 'encode ($enc, $decoded)';
is $decoded_ccs, (decode 'hsr', $encoded_ccs), 'decode ($enc, $encoded)';

 view all matches for this distribution


Encode-Locale

 view release on metacpan or  search on metacpan

lib/Encode/Locale.pm  view on Meta::CPAN

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
=item decode_argv( Encode::FB_CROAK )
 
This will decode the command line arguments to perl (the C<@ARGV> array) in-place.
 
The function will by default replace characters that can't be decoded by
"\x{FFFD}", the Unicode replacement character.
 
Any argument provided is passed as CHECK to underlying Encode::decode() call.
Pass the value C<Encode::FB_CROAK> to have the decoding croak if not all the
command line arguments can be decoded.  See L<Encode/"Handling Malformed Data">
for details on other options for CHECK.
 
=item env( $uni_key )
 
=item env( $uni_key => $uni_value )

lib/Encode/Locale.pm  view on Meta::CPAN

260
261
262
263
264
265
266
267
268
269
270
Interface to get/set environment variables.  Returns the current value as a
Unicode string. The $uni_key and $uni_value arguments are expected to be
Unicode strings as well.  Passing C<undef> as $uni_value deletes the
environment variable named $uni_key.
 
The returned value will have the characters that can't be decoded replaced by
"\x{FFFD}", the Unicode replacement character.
 
There is no interface to request alternative CHECK behavior as for
decode_argv().  If you need that you need to call encode/decode yourself.
For example:

 view all matches for this distribution


Encode-Positive-Digits

 view release on metacpan or  search on metacpan

lib/Encode/Positive/Digits.pm  view on Meta::CPAN

54
55
56
57
58
59
60
61
62
63
64
"number of decoding digits supplied($b) too few, must be at least 2";
 
my @n = split //, $number;
my $n = @n;
 
for(1..$n)                                                                    # Convert each digit to be decoded with its decimal equivalent
 {my $d = $n[$_-1];
  my $i = index($digits, $d);
  $i < 0 and confess "Invalid digit \"$d\" in number $number at position $_";
  $n[$_-1] = $i;
 }

lib/Encode/Positive/Digits.pm  view on Meta::CPAN

103
104
105
106
107
108
109
110
111
112
ok   5 == Encode::Positive::Digits::decode("101", "01");
 
 ok "hello world" eq Encode::Positive::Digits::encode(4830138323689, " abcdefghlopqrw");
 ok 4830138323689 == Encode::Positive::Digits::decode("hello world", " abcdefghlopqrw");
 
The numbers to be encoded or decoded can be much greater than 2**64 via support
from L<Math::BigInt>, such numbers should be placed inside strings to avoid
inadvertent truncation.
 
  my $n = '1'.('0'x999).'1';

 view all matches for this distribution


Encode-Repair

 view release on metacpan or  search on metacpan

lib/Encode/Repair.pm  view on Meta::CPAN

96
97
98
99
100
101
102
103
104
105
106
# prints: beta: β
print repair_double("beta: \xc4\xaa\xc2\xb2\n", {via => 'Latin-7'});
 
 
# Advanced usage
# assumes you have a sample text both correctly decoded in a
# character string, and as a wrongly encoded buffer
 
use Encode::Repair qw(repair_encoding learn_recoding);
use charnames qw(:full);
binmode STDOUT, ':encoding(UTF-8)';

lib/Encode/Repair.pm  view on Meta::CPAN

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
and was encoded as UTF-8 again. The other encoding defaults to ISO-8859-1 aka
Latin-1, and can be overridden with the C<via> option:
 
    my $repaired = repair_double($buffer, {via => 'ISO-8859-2' });
 
It expects an octet string as input, and returns a decoded character string.
 
=item learn_recoding
 
Given a sample of text twice, once correctly decoded and once mistreated,
attemps to find a sequence of encoding and decoding that turns the mistreated
text into the correct form.
 
    my $coding_pattern = learn_recoding(
        from        => $mistreated_buffer,

 view all matches for this distribution


Encode-Safename

 view release on metacpan or  search on metacpan

lib/Encode/Safename.pm  view on Meta::CPAN

36
37
38
39
40
41
42
43
44
45
46
    use Encode qw(decode encode);
    use Encode::Safename;
 
    $encoded = encode('safename', 'Foo Bar Baz.txt');
    # $encoded is now '{f}oo_{b}ar_{b}az.txt'
    $decoded = decode('safename', $encoded);
    # $decoded is now 'Foo Bar Baz.txt'
 
=head1 DESCRIPTION
 
A filename is encoded as follows:

 view all matches for this distribution


Encode

 view release on metacpan or  search on metacpan

Encode.pm  view on Meta::CPAN

505
506
507
508
509
510
511
512
513
514
Do not use it for data exchange.
Unless you want Perl's older "lax" mode, prefer
C<$string = decode("UTF-8", $octets [, CHECK])>.
 
Equivalent to C<$string = decode("utf8", $octets [, CHECK])>.
The sequence of octets represented by $octets is decoded
from (loose, not strict) utf8 into a sequence of logical characters.
Because not all sequences of octets are valid not strict utf8,
it is quite possible for this function to fail.
For CHECK, see L</"Handling Malformed Data">.

Encode.pm  view on Meta::CPAN

707
708
709
710
711
712
713
714
715
716
717
For encodings that are implemented by the C<Encode::XS> module, C<CHECK> C<==>
C<Encode::FB_PERLQQ> puts C<encode> and C<decode> into C<perlqq> fallback mode.
 
When you decode, C<\xI<HH>> is inserted for a malformed character, where
I<HH> is the hex representation of the octet that could not be decoded to
utf8.  When you encode, C<\x{I<HHHH>}> will be inserted, where I<HHHH> is
the Unicode code point (in any number of hex digits) of the character that
cannot be found in the character repertoire of the encoding.
 
The HTML/XML character reference modes are about the same. In place of

Encode.pm  view on Meta::CPAN

752
753
754
755
756
757
758
759
760
761
762
  $ascii = encode("ascii", $utf8, sub{ sprintf "<U+%04X>", shift });
 
Acts like C<FB_PERLQQ> but U+I<XXXX> is used instead of C<\x{I<XXXX>}>.
 
Fallback for C<decode> must return decoded string (sequence of characters)
and takes a list of ordinal values as its arguments. So for
example if you wish to decode octets as UTF-8, and use ISO-8859-15 as
a fallback for bytes that are not valid UTF-8, you could write
 
    $str = decode 'UTF-8', $octets, sub {

 view all matches for this distribution


( run in 0.674 second using v1.01-cache-2.11-cpan-18f4f19a70f )