-
-
20 Nov 2014 11:17:55 UTC
- Distribution: Encoding-HandleUtf8
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (537 / 0 / 9)
- Kwalitee
Bus factor: 1- 84.38% Coverage
- License: mit
- Perl: v5.10.0
- Activity
24 month- Tools
- Download (6.49KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE userNAME
Encoding::HandleUtf8 - Fix the encoding for Perl value store (input) and general output (output) to a console or the web.
VERSION
version 0.004
SYNOPSIS
use Encoding::HandleUtf8 qw( fix_encoding fix_encoding_return ); ######################################################################## # Simple usage - CAUTION: clones the object. printf "%s\n", fix_encoding_return 'input', 'Here are some German umlauts: äÄüÜöÖßẞ'; ######################################################################## # Working with strings. my $string = 'Here are some German umlauts: äÄüÜöÖßẞ'; # Fix the encoding of a input string to handle them safe within Perl. fix_encoding 'input', $string; # Fix the encoding of a Perl variable for output. fix_encoding 'output', $string; print "$string\n"; ######################################################################## # Working with hashes. my %hash = ( a => 'äÄ', u => 'üÜ', o => 'öÖ', ss => 'ßẞ' ); # Fix the encoding of a hash to handle them safe within Perl. fix_encoding 'input', %hash; # Fix the encoding of a Perl hash for output. fix_encoding 'output', %hash; print "$_: $hash{$_}\n" for( keys %hash ); ######################################################################## # Working with hash references. my $hash = { a => 'äÄ', u => 'üÜ', o => 'öÖ', ss => 'ßẞ' }; # Fix the encoding of a hash reference to handle them safe within Perl. fix_encoding 'input', $hash; # Fix the encoding of a Perl hash reference for output. fix_encoding 'output', %hash; print "$_: $hash->{$_}\n" for( keys %{ $hash } ); ######################################################################## # Working with arrays. my @array = ( 'äÄ', 'üÜ', 'öÖ', 'ßẞ' ); # Fix the encoding of an array to handle them safe within Perl. fix_encoding 'input', @array; # Fix the encoding of a Perl array for output. fix_encoding 'output', @array; print "$_: $hash{$_}\n" for( @array ); ######################################################################## # Working with array references. my $array = [ 'äÄ', 'üÜ', 'öÖ', 'ßẞ' ]; # Fix the encoding of an array reference to handle them safe within Perl. fix_encoding 'input', $array; # Fix the encoding of a Perl array reference for output. fix_encoding 'output', @array; print "$_: $hash{$_}\n" for( @{ $array } );
DESCRIPTION
Fix the encoding for Perl value store (input) and general output (output) to e.g. a console or the web.
METHODS
fix_encoding
Takes an direction and a object and fixes the encoding.
- Required parameters
-
- [0]
$direction
-
The direction in which the object should be fixed. Either
input
to work safely with inputs (convert to Unicode) oroutput
to output (convert to UTF-8) them to e.g. a console or the web. - [1]
$obj
-
The actual object which should be fixed. Can either be a
SCALAR
,HASH
orARRAY
(including but not mandentory: references).
- [0]
- Optional parameters
-
- [2]
$skip_latin
-
Skips Encoding::FixLatin's fix_latin call on scalars when
$skip_latin
is set to a true value.
- [2]
fix_encoding_return
Does and takes exactly the same as "fix_encoding" but instead touching the original supplied object it will clone it an return the new encoded object.
CONFIGURATION
Encoding::HandleUtf8 warns about references it does not know. You can turn off this warnings by adding the reference name to the
@IGNORE_LIST
array.push @Encoding::HandleUtf8::IGNORE_LIST, 'JSON::Boolean';
By default the following references will be ignored (no warnings):
AUTHOR
BURNERSK <burnersk@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by BURNERSK <burnersk@cpan.org>.
This is free software, licensed under:
The MIT (X11) License
Module Install Instructions
To install Encoding::HandleUtf8, copy and paste the appropriate command in to your terminal.
cpanm Encoding::HandleUtf8
perl -MCPAN -e shell install Encoding::HandleUtf8
For more information on module installation, please visit the detailed CPAN module installation guide.