Cwd::utf8 - Fully UTF-8 aware Cwd
version 0.011
# Using the utf-8 versions of cwd, getcwd, fastcwd, fastgetcwd use Cwd::utf8; my $dir = getcwd; # Using the utf-8 versions of abs_path use Cwd::utf8 qw(abs_path); my $abs_path = abs_path($file); # Exporting no functions use Cwd::utf8 qw(:none); # NOT "use Cwd::utf8 qw();"! my $real_path = Cwd::real_path($file);
While the original Cwd functions are capable of handling UTF-8 quite well, they expects and return all data as bytes, not as characters.
This module replaces all the Cwd functions with fully UTF-8 aware versions, both expecting and returning characters.
Note: Replacement of functions is not done on DOS, Windows, and OS/2 as these systems do not have full UTF-8 file system support.
The module behaves as a pragma so you can use both use Cwd::utf8 and no Cwd::utf8 to turn utf-8 support on or off.
use Cwd::utf8
no Cwd::utf8
By default, cwd(), getcwd(), fastcwd(), and fastgetcwd() (and, on Win32, getdcwd()) are exported (as with the original Cwd). If you want to prevent this, use use Cwd::utf8 qw(:none). (As all the magic happens in the module's import function, you can not simply use use Cwd::utf8 qw())
use Cwd::utf8 qw(:none)
use Cwd::utf8 qw()
By default Cwd:::utf8 marks decoding errors as fatal (default value for this setting is Encode::FB_CROAK). If you want, you can change this by setting Cwd::utf8::UTF8_CHECK. The value Encode::FB_WARN reports the encoding errors as warnings, and Encode::FB_DEFAULT will completely ignore them. Please see Encode for details. Note: Encode::LEAVE_SRC is always enforced.
Cwd:::utf8
Encode::FB_CROAK
Cwd::utf8::UTF8_CHECK
Encode::FB_WARN
Encode::FB_DEFAULT
Encode::LEAVE_SRC
Please report any bugs or feature requests on the bugtracker website.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
The filesystems of Dos, Windows, and OS/2 do not (fully) support UTF-8. The Cwd function will therefore not be replaced on these systems.
Cwd -- The original module
File::Find::utf8 -- Fully utf-8 aware versions of the File::Find functions.
utf8::all -- Turn on utf-8, all of it. This was also the module I first added the utf-8 aware versions of Cwd and File::Find to before moving them to their own package.
Hayo Baan <info@hayobaan.com>
This software is copyright (c) 2014 by Hayo Baan.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Cwd::utf8, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cwd::utf8
CPAN shell
perl -MCPAN -e shell install Cwd::utf8
For more information on module installation, please visit the detailed CPAN module installation guide.