Permalink
Browse files

[GH #813 #814] [codingstd] Improve new mime_base64 examples

  • Loading branch information...
1 parent 5a51d80 commit c1c30c6009f50cf00f48731437e24e0c0d699eec Reini Urban committed Oct 1, 2012
Showing with 12 additions and 5 deletions.
  1. +1 −1 examples/mime_base64/utf8_base64.pir
  2. +11 −4 examples/mime_base64/utf8_base64.pl
@@ -37,7 +37,7 @@ See L<https://github.com/parrot/parrot/issues/814>
say "expected: 4oC+"
print "result: "
say result_encode
-
+
.end
=head1 AUTHOR
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! perl
# Copyright (C) 2012, Parrot Foundation.
=head1 NAME
@@ -15,9 +15,12 @@ =head1 DESCRIPTION
against parrots.
See L<https://github.com/parrot/parrot/issues/814>
+Note: Unicode stored as MIME::Base64 is inherently endian-dependent.
+
=cut
use strict;
+use warnings;
use MIME::Base64 qw(encode_base64 decode_base64);
use Encode qw(encode);
@@ -31,12 +34,16 @@ =head1 DESCRIPTION
print "encode: utf-8:\"\\x{203e}\" -> ",encode("UTF-8", "\x{203e}"),"\n";
print "expected: 4oC+\n";
print "result: $encoded\n"; # 342 200 276
-
print "decode: ",decode_base64("4oC+"),"\n";
-=head1 AUTHOR
+for ([qq(a2)],[qq(c2a2)],[qw(203e)],[qw(3e 20)],[qw(1000)],[qw(00c7)],[qw(00ff 0000)]){
+ $s = pack "H*",@{$_};
+ printf "0x%s\t=> %s", join("",@{$_}), encode_base64($s);
+}
+
+=head1 AUTHORS
-ronaldxs
+ronaldxs, Reini Urban
=head1 SEE ALSO

0 comments on commit c1c30c6

Please sign in to comment.