NAME
Encode::Safename - An encoding for safe filenames.
VERSION
Version 0.05
SYNOPSIS
An encoding to encode filenames to safe filenames, that is filenames that are valid on all filesystems.
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'
DESCRIPTION
A filename is encoded as follows:
A range of uppercase characters is changed to lowercase characters, and put between braces.
'F' -> '{F}' 'FOO' -> '{foo}'
A range of spaces is changed to underscores.
' ' -> '_' ' ' -> '___'
A range of safe characters (characters that are valid on all filesystems, excluding braces, parentheses, and underscores) is left unchanged.
'f' -> 'f' 'foo' -> 'foo'
All other characters are changed to their Unicode codepoint in hexadecimal notation, and put between parentheses.
':' -> '(3a)' ':?' -> '(3a)(3f)'
Combined, this gives the following:
'FOO: Bar Baz.txt' -> '{foo}(3a)_{b}ar_{b}az.txt'
METHODS
_process LEXER, STRING
Applies LEXER to STRING. Returns both the processed and unprocessed parts.
For internal use only!
decode STRING, CHECK
Decoder for decoding safename. See module Encode::Encoding.
encode STRING, CHECK
Encoder for encoding safename. See module Encode::Encoding.
AUTHOR
Bert Vanderbauwhede, <batlock666 at gmail.com>
BUGS
Please report any bugs or feature requests to bug-encode-safename at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Encode-Safename. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Encode::Safename
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
Based on the module safefilename from Torsten Bronger's Bobcat project (https://launchpad.net/bobcat).
LICENSE AND COPYRIGHT
Copyright 2014 Bert Vanderbauwhede.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See http://www.gnu.org/licenses/ for more information.