utf8-all-0.026000755000000000000 015133135367 12263 5ustar00rootroot000000000000Changes000644000000000000 1174715133135367 13670 0ustar00rootroot000000000000utf8-all-0.026Revision history for Perl module utf8-all 0.026 2026-01-18 * Skipping tests when installing dependencies in AppVeyor build * Removed travis-ci 0.025 2026-01-16 * Force use of archive-tar to prevent issues on MacOs * Adpated to use gmake instead of dmake 0.024 2018-01-05 * Adapted force_global test to work when the perl unicode flag is active [gh-48; HayoBaan] 0.023 2017-05-29 * Global effects (e.g. adding UTF-8 to STD* layers) now only enabled when utf8::all is used from the main package. Options exist to override this default behaviour [gh-47; HayoBaan] 0.022 2017-04-22 * Adpated to changes in Encode v2.89 [HayoBaan] 0.021 2016-08-16 * Fixed: Not encoding readdir DIRHANDLE argument [gh-35; HayoBaan] * Fixed: Enforcing LEAVE_SRC on $utf8::all::UTF_CHECK [HayoBaan] * Skipping thread test on Perl<=v5.10.0 (threads unstable there) [HayoBaan] 0.020 2016-08-11 * Always using PerlIO::utf8_strict as I/O conversion [gh-44; schwern] * Fixed "UTF-16 surrogate 0xd800" error in some builds [HayoBaan] 0.019 2016-08-10 * Removed Build.PL, require >= v0.009 of PluginBundle [HayoBaan] 0.018 2016-08-10 * Now choosing a utf-8 encoding that will not break threads [gh-43; schwern] * Handling utf-8 encoding/decoding errors [gh-35; HayoBaan] * New maintainer: [HayoBaan] 0.017 2015-11-13 * Tests now correctly handle the PERL_UNICODE env variable [gh-40; HayoBaan] and the -C perl command-line flag. * Implemented "no utf8::all" [gh-33; HayoBaan] * Corrected a number of tests [HayoBaan] * Added wrapper for readlink [gh-21; HayoBaan] * Added test for readpipe, qx, and backtick operator [HayoBaan] * Rewrote documentation [HayoBaan] 0.016 2015-01-08 * Not decoding @ARGV when perl is run with -CA [gh-32; HayoBaan] Thank you [saulery] for the tip! * Fixed exclusion of Windows platform [HayoBaan] * Excluding DOS and OS/2 platforms [HayoBaan] * Moved utf-8 aware implementation of File::Find and Cwd to [gh-40; HayoBaan] their own module (File::Find::utf8 and Cwd::utf8) 0.015 2014-08-28 * Fixed changelog for 0.014 * Removed overly optimistic use of v5.20.0 syntax 0.014 2014-08-27 * Skip locale tests on systems without locale support [gh-27; Hugmeir] * Added wrapper for: [HayoBaan] - glob [HayoBaan] - File::Find::find, File::Find::finddepth, [HayoBaan] - Cwd::cwd Cwd::fastcwd Cwd::getcwd Cwd::fastgetcwd [HayoBaan] - Cwd::abs_path Cwd::realpath Cwd::fast_abs_path [HayoBaan] 0.013 2014-08-19 * Warn instead of bailing out of the test suite when autodie [gh-26, gh-22] is old * Only decoding @ARGV when called from the main package [gh-18; HayoBaan] 0.012 2014-08-03 * Disable wrapping readdir on Windows [gh-17] * Don't ship files with names that aren't portable to Windows [gh-17] 0.011 2013-08-03 * Only decode readdir entries if utf8::all is in effect [leont] * Support direct dirhandles in readdir [leont] 0.010 2013-02-02 * Don't depend on localizable error strings 0.009 2012-10-27 * Don't depend on filesystem ordering [leont, gh-14] 0.008 2012-10-24 * Enable unicode_strings (see perldoc feature) [gh-2] * Enable unicode_eval (see perldoc feature) [gh-2] * Enable fc (see perldoc fc) [gh-2] * Wrap CORE::readdir to provide UTF-8 filenames [gh-11] 0.007 2012-08-01 * Use version.pm for comparing versions in the test suite * Better detection of warnings in t/FATAL_utf8.t * Don't fail the test suite if autodie is too old 0.006 2012-07-29 * Be less strict with detecting fatal UTF-8 error in test suite [gh-12] 0.005 2012-07-29 * Use Import::Into instead of home-grown "solution" [gh-10] * Don't permit running with autodie < 2.12, due to RT #54777 [gh-7] * Promote utf8 warnings to fatal errors [gh-1] 0.004 2012-01-04 * Fix test suite for less current versions of Perl [getty, doherty] 0.003 2011-12-21 * Internal refactoring * Load charnames [sartak] 0.002 2011-04-21 * Expand test suite slightly 0.001 2011-04-20 * Split code out of perl5i INSTALL000644000000000000 451715133135367 13403 0ustar00rootroot000000000000utf8-all-0.026This is the Perl distribution utf8-all. Installing utf8-all is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm utf8::all If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan utf8::all ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/utf8::all Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation utf8-all documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc utf8::all For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html LICENSE000644000000000000 4647415133135367 13407 0ustar00rootroot000000000000utf8-all-0.026This software is copyright (c) 2009 by Michael Schwern ; he originated it. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2009 by Michael Schwern ; he originated it. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Moe Ghoul, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2009 by Michael Schwern ; he originated it. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MANIFEST000644000000000000 165115133135367 13477 0ustar00rootroot000000000000utf8-all-0.026# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.036. Changes INSTALL LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README README.mkdn appveyor.yml corpus/testfile dist.ini lib/utf8/all.pm t/00-compile.t t/ARGV.t t/ARGV_nonmain.t t/ARGV_twice.t t/FATAL_utf8.t t/autodie.t t/charnames.t t/fc.t t/force_global.t t/glob.t t/global_nonmain.t t/lexical-again.t t/lexical.t t/no_global.t t/open.t t/readdir.t t/readlink.t t/readpipe.t t/threads.t t/unicode_eval.t t/unicode_strings.t t/utf8.t t/utf8_check.t xt/author/critic.t xt/author/distmeta.t xt/author/eol.t xt/author/minimum-version.t xt/author/mojibake.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-linkcheck.t xt/author/pod-syntax.t xt/author/portability.t xt/author/synopsis.t xt/author/test-version.t xt/release/cpan-changes.t xt/release/dist-manifest.t xt/release/kwalitee.t xt/release/meta-json.t xt/release/unused-vars.t MANIFEST.SKIP000644000000000000 147015133135367 14243 0ustar00rootroot000000000000utf8-all-0.026# Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. META.json000644000000000000 613415133135367 13770 0ustar00rootroot000000000000utf8-all-0.026{ "abstract" : "turn on Unicode - all of it", "author" : [ "Michael Schwern ", "Mike Doherty ", "Hayo Baan " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.036, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "utf8-all", "no_index" : { "directory" : [ "corpus" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.010" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.19", "Test::CPAN::Meta" : "0", "Test::CPAN::Meta::JSON" : "0.16", "Test::DistManifest" : "0", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::MinimumVersion" : "0", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Pod::LinkCheck" : "0", "Test::Portability::Files" : "0", "Test::Synopsis" : "0", "Test::Vars" : "0", "Test::Version" : "1" } }, "runtime" : { "requires" : { "Carp" : "0", "Encode" : "0", "Import::Into" : "0", "PerlIO::utf8_strict" : "0", "Symbol" : "0", "charnames" : "0", "feature" : "0", "open" : "0", "parent" : "0", "perl" : "5.010", "strict" : "0", "utf8" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "PerlIO" : "0", "Test::Exception" : "0", "Test::Fatal" : "0", "Test::More" : "0.96", "Test::Warn" : "0", "autodie" : "0", "constant" : "0", "perl" : "5.010", "threads" : "0", "threads::shared" : "0", "version" : "0.77" } } }, "provides" : { "utf8::all" : { "file" : "lib/utf8/all.pm", "version" : "0.026" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/doherty/utf8-all/issues" }, "homepage" : "http://metacpan.org/release/utf8-all/", "repository" : { "type" : "git", "url" : "git://github.com/doherty/utf8-all.git", "web" : "https://github.com/doherty/utf8-all" } }, "version" : "0.026", "x_generated_by_perl" : "v5.42.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.40", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } META.yml000644000000000000 252415133135367 13617 0ustar00rootroot000000000000utf8-all-0.026--- abstract: 'turn on Unicode - all of it' author: - 'Michael Schwern ' - 'Mike Doherty ' - 'Hayo Baan ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' PerlIO: '0' Test::Exception: '0' Test::Fatal: '0' Test::More: '0.96' Test::Warn: '0' autodie: '0' constant: '0' perl: '5.010' threads: '0' threads::shared: '0' version: '0.77' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.010' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.036, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: utf8-all no_index: directory: - corpus provides: utf8::all: file: lib/utf8/all.pm version: '0.026' requires: Carp: '0' Encode: '0' Import::Into: '0' PerlIO::utf8_strict: '0' Symbol: '0' charnames: '0' feature: '0' open: '0' parent: '0' perl: '5.010' strict: '0' utf8: '0' warnings: '0' resources: bugtracker: https://github.com/doherty/utf8-all/issues homepage: http://metacpan.org/release/utf8-all/ repository: git://github.com/doherty/utf8-all.git version: '0.026' x_generated_by_perl: v5.42.0 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Makefile.PL000644000000000000 401015133135367 14310 0ustar00rootroot000000000000utf8-all-0.026# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.036. use strict; use warnings; use 5.010; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "turn on Unicode - all of it", "AUTHOR" => "Michael Schwern , Mike Doherty , Hayo Baan ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "utf8-all", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.010", "NAME" => "utf8::all", "PREREQ_PM" => { "Carp" => 0, "Encode" => 0, "Import::Into" => 0, "PerlIO::utf8_strict" => 0, "Symbol" => 0, "charnames" => 0, "feature" => 0, "open" => 0, "parent" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "PerlIO" => 0, "Test::Exception" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "Test::Warn" => 0, "autodie" => 0, "constant" => 0, "threads" => 0, "threads::shared" => 0, "version" => "0.77" }, "VERSION" => "0.026", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Encode" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Import::Into" => 0, "PerlIO" => 0, "PerlIO::utf8_strict" => 0, "Symbol" => 0, "Test::Exception" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "Test::Warn" => 0, "autodie" => 0, "charnames" => 0, "constant" => 0, "feature" => 0, "open" => 0, "parent" => 0, "strict" => 0, "threads" => 0, "threads::shared" => 0, "utf8" => 0, "version" => "0.77", "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); README000644000000000000 1257615133135367 13256 0ustar00rootroot000000000000utf8-all-0.026NAME utf8::all - turn on Unicode - all of it VERSION version 0.026 SYNOPSIS use utf8::all; # Turn on UTF-8, all of it. open my $in, '<', 'contains-utf8'; # UTF-8 already turned on here print length 'føø bār'; # 7 UTF-8 characters my $utf8_arg = shift @ARGV; # @ARGV is UTF-8 too (only for main) DESCRIPTION The use utf8 pragma tells the Perl parser to allow UTF-8 in the program text in the current lexical scope. This also means that you can now use literal Unicode characters as part of strings, variable names, and regular expressions. utf8::all goes further: * charnames are imported so \N{...} sequences can be used to compile Unicode characters based on names. * On Perl v5.11.0 or higher, the use feature 'unicode_strings' is enabled. * use feature fc and use feature unicode_eval are enabled on Perl 5.16.0 and higher. * Filehandles are opened with UTF-8 encoding turned on by default (including STDIN, STDOUT, and STDERR when utf8::all is used from the main package). Meaning that they automatically convert UTF-8 octets to characters and vice versa. If you don't want UTF-8 for a particular filehandle, you'll have to set binmode $filehandle. * @ARGV gets converted from UTF-8 octets to Unicode characters (when utf8::all is used from the main package). This is similar to the behaviour of the -CA perl command-line switch (see perlrun). * readdir, readlink, readpipe (including the qx// and backtick operators), and glob (including the <> operator) now all work with and return Unicode characters instead of (UTF-8) octets (again only when utf8::all is used from the main package). Lexical Scope The pragma is lexically-scoped, so you can do the following if you had some reason to: { use utf8::all; open my $out, '>', 'outfile'; my $utf8_str = 'føø bār'; print length $utf8_str, "\n"; # 7 print $out $utf8_str; # out as utf8 } open my $in, '<', 'outfile'; # in as raw my $text = do { local $/; <$in>}; print length $text, "\n"; # 10, not 7! Instead of lexical scoping, you can also use no utf8::all to turn off the effects. Note that the effect on @ARGV and the STDIN, STDOUT, and STDERR file handles is always global and can not be undone! Enabling/Disabling Global Features As described above, the default behaviour of utf8::all is to convert @ARGV and to open the STDIN, STDOUT, and STDERR file handles with UTF-8 encoding, and override the readlink and readdir functions and glob operators when utf8::all is used from the main package. If you want to disable these features even when utf8::all is used from the main package, add the option NO-GLOBAL (or LEXICAL-ONLY) to the use line. E.g.: use utf8::all 'NO-GLOBAL'; If on the other hand you want to enable these global effects even when utf8::all was used from another package than main, use the option GLOBAL on the use line: use utf8::all 'GLOBAL'; UTF-8 Errors utf8::all will handle invalid code points (i.e., utf-8 that does not map to a valid unicode "character"), as a fatal error. For glob, readdir, and readlink, one can change this behaviour by setting the attribute "$utf8::all::UTF8_CHECK". ATTRIBUTES $utf8::all::UTF8_CHECK By default utf8::all marks decoding errors as fatal (default value for this setting is Encode::FB_CROAK). If you want, you can change this by setting $utf8::all::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. Important: Only controls the handling of decoding errors in glob, readdir, and readlink. INTERACTION WITH AUTODIE If you use autodie, which is a great idea, you need to use at least version 2.12, released on June 26, 2012 . Otherwise, autodie obliterates the IO layers set by the open pragma. See RT #54777 and GH #7 . BUGS 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. COMPATIBILITY The filesystems of Dos, Windows, and OS/2 do not (fully) support UTF-8. The readlink and readdir functions and glob operators will therefore not be replaced on these systems. SEE ALSO * File::Find::utf8 for fully utf-8 aware File::Find functions. * Cwd::utf8 for fully utf-8 aware Cwd functions. AUTHORS * Michael Schwern * Mike Doherty * Hayo Baan COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Michael Schwern ; he originated it. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. README.mkdn000644000000000000 1273215133135367 14200 0ustar00rootroot000000000000utf8-all-0.026# NAME utf8::all - turn on Unicode - all of it # VERSION version 0.026 # SYNOPSIS use utf8::all; # Turn on UTF-8, all of it. open my $in, '<', 'contains-utf8'; # UTF-8 already turned on here print length 'føø bār'; # 7 UTF-8 characters my $utf8_arg = shift @ARGV; # @ARGV is UTF-8 too (only for main) # DESCRIPTION The `use utf8` pragma tells the Perl parser to allow UTF-8 in the program text in the current lexical scope. This also means that you can now use literal Unicode characters as part of strings, variable names, and regular expressions. `utf8::all` goes further: - [`charnames`](https://metacpan.org/pod/charnames) are imported so `\N{...}` sequences can be used to compile Unicode characters based on names. - On Perl `v5.11.0` or higher, the `use feature 'unicode_strings'` is enabled. - `use feature fc` and `use feature unicode_eval` are enabled on Perl `5.16.0` and higher. - Filehandles are opened with UTF-8 encoding turned on by default (including `STDIN`, `STDOUT`, and `STDERR` when `utf8::all` is used from the `main` package). Meaning that they automatically convert UTF-8 octets to characters and vice versa. If you _don't_ want UTF-8 for a particular filehandle, you'll have to set `binmode $filehandle`. - `@ARGV` gets converted from UTF-8 octets to Unicode characters (when `utf8::all` is used from the `main` package). This is similar to the behaviour of the `-CA` perl command-line switch (see [perlrun](https://metacpan.org/pod/perlrun)). - `readdir`, `readlink`, `readpipe` (including the `qx//` and backtick operators), and [`glob`](https://metacpan.org/pod/perlfunc#glob) (including the `<>` operator) now all work with and return Unicode characters instead of (UTF-8) octets (again only when `utf8::all` is used from the `main` package). ## Lexical Scope The pragma is lexically-scoped, so you can do the following if you had some reason to: { use utf8::all; open my $out, '>', 'outfile'; my $utf8_str = 'føø bār'; print length $utf8_str, "\n"; # 7 print $out $utf8_str; # out as utf8 } open my $in, '<', 'outfile'; # in as raw my $text = do { local $/; <$in>}; print length $text, "\n"; # 10, not 7! Instead of lexical scoping, you can also use `no utf8::all` to turn off the effects. Note that the effect on `@ARGV` and the `STDIN`, `STDOUT`, and `STDERR` file handles is always global and can not be undone! ## Enabling/Disabling Global Features As described above, the default behaviour of `utf8::all` is to convert `@ARGV` and to open the `STDIN`, `STDOUT`, and `STDERR` file handles with UTF-8 encoding, and override the `readlink` and `readdir` functions and `glob` operators when `utf8::all` is used from the `main` package. If you want to disable these features even when `utf8::all` is used from the `main` package, add the option `NO-GLOBAL` (or `LEXICAL-ONLY`) to the use line. E.g.: use utf8::all 'NO-GLOBAL'; If on the other hand you want to enable these global effects even when `utf8::all` was used from another package than `main`, use the option `GLOBAL` on the use line: use utf8::all 'GLOBAL'; ## UTF-8 Errors `utf8::all` will handle invalid code points (i.e., utf-8 that does not map to a valid unicode "character"), as a fatal error. For `glob`, `readdir`, and `readlink`, one can change this behaviour by setting the attribute ["$utf8::all::UTF8\_CHECK"](#utf8-all-utf8_check). # ATTRIBUTES ## $utf8::all::UTF8\_CHECK By default `utf8::all` marks decoding errors as fatal (default value for this setting is `Encode::FB_CROAK`). If you want, you can change this by setting `$utf8::all::UTF8_CHECK`. The value `Encode::FB_WARN` reports the encoding errors as warnings, and `Encode::FB_DEFAULT` will completely ignore them. Please see [Encode](https://metacpan.org/pod/Encode) for details. Note: `Encode::LEAVE_SRC` is _always_ enforced. Important: Only controls the handling of decoding errors in `glob`, `readdir`, and `readlink`. # INTERACTION WITH AUTODIE If you use [autodie](https://metacpan.org/pod/autodie), which is a great idea, you need to use at least version **2.12**, released on [June 26, 2012](https://metacpan.org/source/PJF/autodie-2.12/Changes#L3). Otherwise, autodie obliterates the IO layers set by the [open](https://metacpan.org/pod/open) pragma. See [RT \#54777](https://rt.cpan.org/Ticket/Display.html?id=54777) and [GH \#7](https://github.com/doherty/utf8-all/issues/7). # BUGS Please report any bugs or feature requests on the bugtracker [website](https://github.com/doherty/utf8-all/issues). 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. # COMPATIBILITY The filesystems of Dos, Windows, and OS/2 do not (fully) support UTF-8. The `readlink` and `readdir` functions and `glob` operators will therefore not be replaced on these systems. # SEE ALSO - [File::Find::utf8](https://metacpan.org/pod/File%3A%3AFind%3A%3Autf8) for fully utf-8 aware File::Find functions. - [Cwd::utf8](https://metacpan.org/pod/Cwd%3A%3Autf8) for fully utf-8 aware Cwd functions. # AUTHORS - Michael Schwern - Mike Doherty - Hayo Baan # COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Michael Schwern ; he originated it. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. appveyor.yml000644000000000000 63215133135367 14714 0ustar00rootroot000000000000utf8-all-0.026branches: except: - /travis/ skip_tags: true cache: - C:\strawberry -> appveyor.yml install: - if not exist "C:\strawberry" cinst strawberryperl - set PATH=C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;%PATH% - cd C:\projects\%APPVEYOR_PROJECT_NAME% - cpanm --installdeps --notest --force . build_script: - perl Makefile.PL - gmake test_script: - gmake test corpus000755000000000000 015133135367 13517 5ustar00rootroot000000000000utf8-all-0.026testfile000644000000000000 1215133135367 15351 0ustar00rootroot000000000000utf8-all-0.026/corpusテスト dist.ini000644000000000000 67215133135367 13774 0ustar00rootroot000000000000utf8-all-0.026name = utf8-all author = Michael Schwern author = Mike Doherty author = Hayo Baan license = Perl_5 copyright_holder = Michael Schwern ; he originated it copyright_year = 2009 [@Author::HAYOBAAN] :version = 0.009 is_cpan = 1 max_target_perl = 5.010 [ArchiveTar] lib000755000000000000 015133135367 12752 5ustar00rootroot000000000000utf8-all-0.026utf8000755000000000000 015133135367 13640 5ustar00rootroot000000000000utf8-all-0.026/liball.pm000644000000000000 3765615133135367 15146 0ustar00rootroot000000000000utf8-all-0.026/lib/utf8package utf8::all; use strict; use warnings; use 5.010; # state # ABSTRACT: turn on Unicode - all of it our $VERSION = '0.026'; # VERSION #pod =head1 SYNOPSIS #pod #pod use utf8::all; # Turn on UTF-8, all of it. #pod #pod open my $in, '<', 'contains-utf8'; # UTF-8 already turned on here #pod print length 'føø bār'; # 7 UTF-8 characters #pod my $utf8_arg = shift @ARGV; # @ARGV is UTF-8 too (only for main) #pod #pod =head1 DESCRIPTION #pod #pod The C pragma tells the Perl parser to allow UTF-8 in the #pod program text in the current lexical scope. This also means that you #pod can now use literal Unicode characters as part of strings, variable #pod names, and regular expressions. #pod #pod C goes further: #pod #pod =over 4 #pod #pod =item * #pod #pod L|charnames> are imported so C<\N{...}> sequences can be #pod used to compile Unicode characters based on names. #pod #pod =item * #pod #pod On Perl C or higher, the C is #pod enabled. #pod #pod =item * #pod #pod C and C are enabled on Perl #pod C<5.16.0> and higher. #pod #pod =item * #pod #pod Filehandles are opened with UTF-8 encoding turned on by default #pod (including C, C, and C when C is #pod used from the C
package). Meaning that they automatically #pod convert UTF-8 octets to characters and vice versa. If you I #pod want UTF-8 for a particular filehandle, you'll have to set C. #pod #pod =item * #pod #pod C<@ARGV> gets converted from UTF-8 octets to Unicode characters (when #pod C is used from the C
package). This is similar to the #pod behaviour of the C<-CA> perl command-line switch (see L). #pod #pod =item * #pod #pod C, C, C (including the C and #pod backtick operators), and L|perlfunc/glob> (including the C<< #pod <> >> operator) now all work with and return Unicode characters #pod instead of (UTF-8) octets (again only when C is used from #pod the C
package). #pod #pod =back #pod #pod =head2 Lexical Scope #pod #pod The pragma is lexically-scoped, so you can do the following if you had #pod some reason to: #pod #pod { #pod use utf8::all; #pod open my $out, '>', 'outfile'; #pod my $utf8_str = 'føø bār'; #pod print length $utf8_str, "\n"; # 7 #pod print $out $utf8_str; # out as utf8 #pod } #pod open my $in, '<', 'outfile'; # in as raw #pod my $text = do { local $/; <$in>}; #pod print length $text, "\n"; # 10, not 7! #pod #pod Instead of lexical scoping, you can also use C to turn #pod off the effects. #pod #pod Note that the effect on C<@ARGV> and the C, C, and #pod C file handles is always global and can not be undone! #pod #pod =head2 Enabling/Disabling Global Features #pod #pod As described above, the default behaviour of C is to #pod convert C<@ARGV> and to open the C, C, and C #pod file handles with UTF-8 encoding, and override the C and #pod C functions and C operators when C is used #pod from the C
package. #pod #pod If you want to disable these features even when C is used #pod from the C
package, add the option C (or #pod C) to the use line. E.g.: #pod #pod use utf8::all 'NO-GLOBAL'; #pod #pod If on the other hand you want to enable these global effects even when #pod C was used from another package than C
, use the #pod option C on the use line: #pod #pod use utf8::all 'GLOBAL'; #pod #pod =head2 UTF-8 Errors #pod #pod C will handle invalid code points (i.e., utf-8 that does #pod not map to a valid unicode "character"), as a fatal error. #pod #pod For C, C, and C, one can change this #pod behaviour by setting the attribute L. #pod #pod =head1 COMPATIBILITY #pod #pod The filesystems of Dos, Windows, and OS/2 do not (fully) support #pod UTF-8. The C and C functions and C operators #pod will therefore not be replaced on these systems. #pod #pod =head1 SEE ALSO #pod #pod =over 4 #pod #pod =item * #pod #pod L for fully utf-8 aware File::Find functions. #pod #pod =item * #pod #pod L for fully utf-8 aware Cwd functions. #pod #pod =back #pod #pod =cut use Import::Into; use parent qw(Encode charnames utf8 open warnings feature); use Symbol qw(qualify_to_ref); use Config; # Holds the pointers to the original version of redefined functions state %_orig_functions; # Current (i.e., this) package my $current_package = __PACKAGE__; require Carp; $Carp::Internal{$current_package}++; # To get warnings reported at correct caller level #pod =attr $utf8::all::UTF8_CHECK #pod #pod By default C marks decoding errors as fatal (default value #pod for this setting is C). If you want, you can change this by #pod setting C<$utf8::all::UTF8_CHECK>. The value C reports #pod the encoding errors as warnings, and C will completely #pod ignore them. Please see L for details. Note: C is #pod I enforced. #pod #pod Important: Only controls the handling of decoding errors in C, #pod C, and C. #pod #pod =cut use Encode (); use PerlIO::utf8_strict; our $UTF8_CHECK = Encode::FB_CROAK | Encode::LEAVE_SRC; # Die on encoding errors # UTF-8 Encoding object my $_UTF8 = Encode::find_encoding('UTF-8'); sub import { # Enable features/pragmas in calling package my $target = caller; # Enable global effects be default only when imported from main package my $no_global = $target ne 'main'; # Override global? if (defined $_[1] && $_[1] =~ /^(?:(NO-)?GLOBAL|LEXICAL-ONLY)$/i) { $no_global = $_[1] !~ /^GLOBAL$/i; splice(@_, 1, 1); # Remove option from import's arguments } 'utf8'->import::into($target); 'open'->import::into($target, 'IO' => ':utf8_strict'); # use open ':std' only works with some encodings. state $have_encoded_std = 0; unless ($no_global || $have_encoded_std++) { binmode STDERR, ':utf8_strict'; binmode STDOUT, ':utf8_strict'; binmode STDIN, ':utf8_strict'; } 'charnames'->import::into($target, qw{:full :short}); 'warnings'->import::into($target, qw{FATAL utf8}); 'feature'->import::into($target, qw{unicode_strings}) if $^V >= v5.11.0; 'feature'->import::into($target, qw{unicode_eval fc}) if $^V >= v5.16.0; unless ($no_global || $^O =~ /MSWin32|cygwin|dos|os2/) { no strict qw(refs); ## no critic (TestingAndDebugging::ProhibitNoStrict) no warnings qw(redefine); # Replace readdir with utf8 aware version *{$target . '::readdir'} = \&_utf8_readdir; # Replace readdir with utf8 aware version *{$target . '::readlink'} = \&_utf8_readlink; # Replace glob with utf8 aware version *{$target . '::glob'} = \&_utf8_glob; # Set compiler hint to encode/decode in the redefined functions $^H{'utf8::all'} = 1; } # Make @ARGV utf-8 when, unless perl was launched with the -CA # flag as this already has @ARGV decoded automatically. -CA is # active if the the fifth bit (32) of the ${^UNICODE} variable is # set. (see perlrun on the -C command switch for details about # ${^UNICODE}) unless ($no_global || (${^UNICODE} & 32)) { state $have_encoded_argv = 0; if (!$have_encoded_argv++) { $UTF8_CHECK |= Encode::LEAVE_SRC if $UTF8_CHECK; # Enforce LEAVE_SRC $_ = ($_ ? $_UTF8->decode($_, $UTF8_CHECK) : $_) for @ARGV; } } return; } sub unimport { ## no critic (Subroutines::ProhibitBuiltinHomonyms) # Disable features/pragmas in calling package # Note: Does NOT undo the effect on @ARGV, # nor on the STDIN, STDOUT, and STDERR file handles! # These effects are always "global". my $target = caller; 'utf8'->unimport::out_of($target); 'open'->import::into($target, qw{IO :bytes}); unless ($^O =~ /MSWin32|cygwin|dos|os2/) { $^H{'utf8::all'} = 0; # Reset compiler hint } return; } sub _utf8_readdir(*) { ## no critic (Subroutines::ProhibitSubroutinePrototypes) my $pre_handle = shift; my $hints = (caller 0)[10]; my $handle = ref($pre_handle) ? $pre_handle : qualify_to_ref($pre_handle, caller); if (not $hints->{'utf8::all'}) { return CORE::readdir($handle); } else { $UTF8_CHECK |= Encode::LEAVE_SRC if $UTF8_CHECK; # Enforce LEAVE_SRC if (wantarray) { return map { $_ ? $_UTF8->decode($_, $UTF8_CHECK) : $_ } CORE::readdir($handle); } else { my $r = CORE::readdir($handle); return $r ? $_UTF8->decode($r, $UTF8_CHECK) : $r; } } } sub _utf8_readlink(_) { ## no critic (Subroutines::ProhibitSubroutinePrototypes) my $arg = shift; my $hints = (caller 0)[10]; if (not $hints->{'utf8::all'}) { return CORE::readlink($arg); } else { $UTF8_CHECK |= Encode::LEAVE_SRC if $UTF8_CHECK; # Enforce LEAVE_SRC $arg = $arg ? $_UTF8->encode($arg, $UTF8_CHECK) : $arg; my $r = CORE::readlink($arg); return $r ? $_UTF8->decode($r, $UTF8_CHECK) : $r; } } sub _utf8_glob { my $arg = $_[0]; # Making this a lexical somehow is important! my $hints = (caller 0)[10]; if (not $hints->{'utf8::all'}) { return CORE::glob($arg); } else { $UTF8_CHECK |= Encode::LEAVE_SRC if $UTF8_CHECK; # Enforce LEAVE_SRC $arg = $arg ? $_UTF8->encode($arg, $UTF8_CHECK) : $arg; if (wantarray) { return map { $_ ? $_UTF8->decode($_, $UTF8_CHECK) : $_ } CORE::glob($arg); } else { my $r = CORE::glob($arg); return $r ? $_UTF8->decode($r, $UTF8_CHECK) : $r; } } } #pod =head1 INTERACTION WITH AUTODIE #pod #pod If you use L, which is a great idea, you need to use at least #pod version B<2.12>, released on L. #pod Otherwise, autodie obliterates the IO layers set by the L #pod pragma. See L and L. #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME utf8::all - turn on Unicode - all of it =head1 VERSION version 0.026 =head1 SYNOPSIS use utf8::all; # Turn on UTF-8, all of it. open my $in, '<', 'contains-utf8'; # UTF-8 already turned on here print length 'føø bār'; # 7 UTF-8 characters my $utf8_arg = shift @ARGV; # @ARGV is UTF-8 too (only for main) =head1 DESCRIPTION The C pragma tells the Perl parser to allow UTF-8 in the program text in the current lexical scope. This also means that you can now use literal Unicode characters as part of strings, variable names, and regular expressions. C goes further: =over 4 =item * L|charnames> are imported so C<\N{...}> sequences can be used to compile Unicode characters based on names. =item * On Perl C or higher, the C is enabled. =item * C and C are enabled on Perl C<5.16.0> and higher. =item * Filehandles are opened with UTF-8 encoding turned on by default (including C, C, and C when C is used from the C
package). Meaning that they automatically convert UTF-8 octets to characters and vice versa. If you I want UTF-8 for a particular filehandle, you'll have to set C. =item * C<@ARGV> gets converted from UTF-8 octets to Unicode characters (when C is used from the C
package). This is similar to the behaviour of the C<-CA> perl command-line switch (see L). =item * C, C, C (including the C and backtick operators), and L|perlfunc/glob> (including the C<< <> >> operator) now all work with and return Unicode characters instead of (UTF-8) octets (again only when C is used from the C
package). =back =head2 Lexical Scope The pragma is lexically-scoped, so you can do the following if you had some reason to: { use utf8::all; open my $out, '>', 'outfile'; my $utf8_str = 'føø bār'; print length $utf8_str, "\n"; # 7 print $out $utf8_str; # out as utf8 } open my $in, '<', 'outfile'; # in as raw my $text = do { local $/; <$in>}; print length $text, "\n"; # 10, not 7! Instead of lexical scoping, you can also use C to turn off the effects. Note that the effect on C<@ARGV> and the C, C, and C file handles is always global and can not be undone! =head2 Enabling/Disabling Global Features As described above, the default behaviour of C is to convert C<@ARGV> and to open the C, C, and C file handles with UTF-8 encoding, and override the C and C functions and C operators when C is used from the C
package. If you want to disable these features even when C is used from the C
package, add the option C (or C) to the use line. E.g.: use utf8::all 'NO-GLOBAL'; If on the other hand you want to enable these global effects even when C was used from another package than C
, use the option C on the use line: use utf8::all 'GLOBAL'; =head2 UTF-8 Errors C will handle invalid code points (i.e., utf-8 that does not map to a valid unicode "character"), as a fatal error. For C, C, and C, one can change this behaviour by setting the attribute L. =head1 ATTRIBUTES =head2 $utf8::all::UTF8_CHECK By default C marks decoding errors as fatal (default value for this setting is C). If you want, you can change this by setting C<$utf8::all::UTF8_CHECK>. The value C reports the encoding errors as warnings, and C will completely ignore them. Please see L for details. Note: C is I enforced. Important: Only controls the handling of decoding errors in C, C, and C. =head1 INTERACTION WITH AUTODIE If you use L, which is a great idea, you need to use at least version B<2.12>, released on L. Otherwise, autodie obliterates the IO layers set by the L pragma. See L and L. =head1 BUGS Please report any bugs or feature requests on the bugtracker L. 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. =head1 COMPATIBILITY The filesystems of Dos, Windows, and OS/2 do not (fully) support UTF-8. The C and C functions and C operators will therefore not be replaced on these systems. =head1 SEE ALSO =over 4 =item * L for fully utf-8 aware File::Find functions. =item * L for fully utf-8 aware Cwd functions. =back =head1 AUTHORS =over 4 =item * Michael Schwern =item * Mike Doherty =item * Hayo Baan =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Michael Schwern ; he originated it. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut t000755000000000000 015133135367 12447 5ustar00rootroot000000000000utf8-all-0.02600-compile.t000644000000000000 260615133135367 14644 0ustar00rootroot000000000000utf8-all-0.026/tuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.059 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'utf8/all.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'}.$str.q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; ARGV.t000644000000000000 133015133135367 13527 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that utf8::all makes @ARGV utf8 BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); if (${^UNICODE} & 32) { # If we run with the Perl Unicode flag to automatically # convert the command-line arguments to unicode characters, # we need to do so here too! require Encode; $_ = Encode::decode('UTF-8' ,$_) for @ARGV; } } use utf8::all; use Test::More tests => 1; # føø bar bāz テスト but now as unicode characters is_deeply \@ARGV => [ "\x{66}\x{f8}\x{f8}", "\x{62}\x{61}\x{72}", "\x{62}\x{101}\x{7a}", "\x{30c6}\x{30b9}\x{30c8}" ], '@ARGV as unicode characters instead of utf-8 octets'; ARGV_nonmain.t000644000000000000 105615133135367 15253 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that utf8::all makes @ARGV utf8 (but not when not loaded from main) BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); } package not_main; use utf8::all; use Test::More tests => 1; is_deeply \@ARGV => [ # føø bar bāz テスト still as utf-8 encoded octets "\x{66}\x{c3}\x{b8}\x{c3}\x{b8}", "\x{62}\x{61}\x{72}", "\x{62}\x{c4}\x{81}\x{7a}", "\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}", ], 'non main package: @ARGV still as utf-8 encoded octets'; ARGV_twice.t000644000000000000 147515133135367 14734 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that utf8::all doesn't double encode @ARGV [perl5i github 176] BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); if (${^UNICODE} & 32) { # If we run with the Perl Unicode flag to automatically # convert the command-line arguments to unicode characters, # we need to do so here too! require Encode; $_ = Encode::decode('UTF-8' ,$_) for @ARGV; } } { package Foo; use utf8::all; } { use utf8::all; } use utf8::all; use Test::More tests => 1; # føø bar bāz テスト still intact as unicode characters is_deeply \@ARGV => [ "\x{66}\x{f8}\x{f8}", "\x{62}\x{61}\x{72}", "\x{62}\x{101}\x{7a}", "\x{30c6}\x{30b9}\x{30c8}" ], '@ARGV as unicode characters instead of utf-8 octets'; FATAL_utf8.t000644000000000000 145615133135367 14576 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More tests => 3; use Test::Warn; use utf8::all; # Fatal warning warning_like { eval q/open my $out, '>', \my $mem; binmode $out, ':raw'; print $out "\x{FACE}"/; warn $@ } qr/Wide character/, 'Fatal "Wide character" warning' or diag $@; # Non-fatal warning warning_like { open my $out, '>', \my $mem; binmode $out, ':raw'; use warnings NONFATAL => 'utf8'; # downgrade to non-fatal utf8 warnings print $out "\x{FACE}" } 'utf8', 'Non-fatal "Wide character" warning' or diag $@; warning_is { open my $out, '>', \my $mem; binmode $out, ':raw'; no warnings FATAL => 'utf8'; # disable fatal utf8 warnings print $out "\x{FACE}"; } [], 'No "Wide character" warning'; autodie.t000644000000000000 316015133135367 14425 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use version 0.77; use Test::More 0.96; use Test::Fatal; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; mkdir "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}" or die "Couldn't create directory corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}: $!" unless -d "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}"; if ( eval { require autodie; 1 } ) { diag <parse($autodie::VERSION) <= version->parse(2.11); plan tests => 2; } else { plan skip_all => "autodie is required for these tests (but is not a prerequisite)"; } no autodie; subtest 'autodie first' => sub { plan tests => 2; use autodie; use utf8::all; opendir my $dh, 'corpus'; my @files = sort grep { !m{^\.} } readdir $dh; closedir $dh; is_deeply \@files, [sort "\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", "testfile"]; my $exception = exception { opendir my $no_dh, 'nonexistent' }; like $exception => qr/^\QCan't opendir/; }; subtest 'autodie last' => sub { plan tests => 2; use utf8::all; use autodie; opendir my $dh, 'corpus'; my @files = sort grep { !m{^\.} } readdir $dh; closedir $dh; is_deeply \@files, [ sort "\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", "testfile"]; my $exception = exception { opendir my $no_dh, 'nonexistent' }; like $exception, qr/^\QCan't opendir/; }; charnames.t000644000000000000 57115133135367 14717 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that utf8::all imports charnames for \N use utf8::all; use Test::More tests => 3; is_deeply "\N{GREEK SMALL LETTER SIGMA} is called sigma.", "σ is called sigma.", ':full'; is_deeply "\N{greek:Sigma}", "Σ", ':short'; is_deeply charnames::vianame("GOTHIC LETTER AHSA"), 66352, 'charnames::vianame'; fc.t000644000000000000 77015133135367 13347 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # utf8::all should turn on feature qw(unicode_strings) use strict; use warnings; use Test::More; plan $^V >= v5.16.0 ? (tests => 3) : (skip_all => q/Can't enable fc on perl < 5.16.0/); { no warnings qw(syntax); eval q/fc 'ABC' eq fc 'abc';/; ok $@, 'Got an error using fc without utf8::all...'; like $@ => qr/^syntax error/, '...and the error was a syntax error' or diag $@; } eval q/ use utf8::all; fc 'XYZ' eq fc 'xyz'; /; ok !$@, 'no error with utf8::all' or diag $@;force_global.t000644000000000000 235415133135367 15415 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that ust8::all with GLOBAL does change @ARGV, STDIN, STDOUT, STDERR use strict; use warnings; BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); } package not_main; use utf8::all 'GLOBAL'; use PerlIO; use Test::More; SKIP: { # If we run with the Perl Unicode flag to automatically # convert the command-line arguments to unicode characters, # we need to skip this test skip 'Perl Unicode flag set to automatically convert command-line arguments', 1 if (${^UNICODE} & 32); # føø bar bāz テスト but now as unicode characters is_deeply \@ARGV => [ "\x{66}\x{f8}\x{f8}", "\x{62}\x{61}\x{72}", "\x{62}\x{101}\x{7a}", "\x{30c6}\x{30b9}\x{30c8}" ], '@ARGV as unicode characters instead of utf-8 octets'; } # Test the standard handles are utf-8 my $utf8_flag = 1; for my $fh (*STDIN, *STDOUT, *STDERR) { my @layers = PerlIO::get_layers($fh); ok(grep(m/utf8/, @layers), 'utf8 appears in the perlio layers') or diag explain { $fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), 'utf-?8[-_]strict appears in the perlio layers') or diag explain { $fh => \@layers }; } done_testing; glob.t000644000000000000 256615133135367 13727 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More 0.96; use Encode qw/decode FB_CROAK/; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; mkdir "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}" or die "Couldn't create directory corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}: $!" unless -d "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}"; plan tests => 1; subtest glob => sub { plan tests => 14; my @globs = (glob("corpus/*"), glob("corpus/{testfile,\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}}"), ); my $count = 0; while (my $glob = glob("corpus/*")) { push(@globs, $glob); $count++; } @globs = sort @globs; my @utf8_globs; my $utf8_count = 0; { use utf8::all; @utf8_globs = (glob("corpus/*"), glob("corpus/{testfile,\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}}"), ); while (my $glob = glob("corpus/*")) { push(@utf8_globs, $glob); $utf8_count++; } } @utf8_globs = sort @utf8_globs; is $count => 2, "glob: scalar version"; is $utf8_count => 2, "utf8_glob: scalar version"; for (my $i=0; $i<4; $i++) { is $globs[$i] => $utf8_globs[$i]; isnt $globs[4+$i] => $utf8_globs[4+$i]; is decode('UTF-8', $globs[4+$i], FB_CROAK) => $utf8_globs[4+$i]; } }; global_nonmain.t000644000000000000 364315133135367 15760 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that ust8::all from non-main package does not change @ARGV, STDIN, STDOUT, STDERR use strict; use warnings; BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); } package not_main; use utf8::all; use PerlIO; use Test::More; SKIP: { # If we run with the Perl Unicode flag to automatically # convert the command-line arguments to unicode characters, # we need to skip this test skip 'Perl Unicode flag set to automatically convert command-line arguments', 1 if (${^UNICODE} & 32); # føø bar bāz テスト still as utf-8 encoded octets is_deeply \@ARGV => [ "\x{66}\x{c3}\x{b8}\x{c3}\x{b8}", "\x{62}\x{61}\x{72}", "\x{62}\x{c4}\x{81}\x{7a}", "\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}" ], '@ARGV as utf-8 octets'; } # Test the standard handles are NOT utf-8 my $utf8_flag = 1; for my $fh (*STDIN, *STDOUT, *STDERR) { my @layers = PerlIO::get_layers($fh); SKIP: { # If we have the Perl Unicode flag set that adds the UTF-8 layer, # we need to skip this test. skip 'Perl Unicode flag set that always adds UTF-8 layer', 1 if (${^UNICODE} & $utf8_flag); ok(!grep(/utf8/, @layers), q{utf8 does not appear in perlio layers}) or diag explain { $fh => \@layers }; } ok(!grep(m/utf-?8[-_]strict/, @layers), q{utf-?8[-_]strict does not appear in the perlio layers}) or diag explain { $fh => \@layers }; $utf8_flag *= 2; } ok((open my $test_fh, ">", "perlio_test"), 'open file for writing with utf8::all'); END { unlink "perlio_test" } my @layers = PerlIO::get_layers($test_fh); ok(grep(m/utf8/, @layers), 'utf8 appears in the perlio layers') or diag explain { $test_fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), 'utf-?8[-_]strict appears in the perlio layers') or diag explain { $test_fh => \@layers }; done_testing; lexical-again.t000644000000000000 444615133135367 15501 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # no utf8::all should disable its effects lexically # Note: Changes to @ARGV, STDIN, STDOU, and STDERR are always global! use Test::More tests => 17; use PerlIO; my $expected_unicode = "\x{30c6}\x{30b9}\x{30c8}"; # Unicode characters my $expected_utf8 = "\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}"; # UTF-8 encoded octets use utf8::all; is "テスト" => $expected_unicode, 'Literal string should be characters under utf8::all'; { no utf8::all; is "テスト" => $expected_utf8, 'Literal string should be utf-8 encoded octets without utf8::all'; # Test the standard handles and all newly opened handles are not utf8 ok((open my $out, ">", "lexical_octets.tmp"), 'open file for writing without utf8::all'); END { unlink "lexical_octets.tmp" } ok((open my $in, '<', 'corpus/testfile'), 'open file for reading without utf8::all'); my $contents = do { local $/; <$in>}; is $contents, "$expected_utf8\n", 'octets retreived OK'; my %handles = ( IN => $in, OUT => $out, ); for my $fh (keys %handles) { my @layers = PerlIO::get_layers($handles{$fh}); ok(!grep(m/utf8/, @layers), "$fh: utf8 does not appear in the perlio layers") or diag explain { $fh => \@layers }; ok(!grep(m/utf-?8[-_]strict/, @layers), "$fh: utf-?8[-_]strict does not appear in the perlio layers") or diag explain { $fh => \@layers }; } } is "テスト" => $expected_unicode, 'Literal string should be characters under utf8::all (again)'; # Test the standard handles and all newly opened handles are utf8 (again) ok((open my $out, ">", "lexical_unicode.tmp"), 'open file for writing with utf8::all'); END { unlink "lexical_unicode.tmp" } ok((open my $in, '<', 'corpus/testfile'), 'open file for reading with utf8::all'); my $contents = do { local $/; <$in>}; is $contents, "$expected_unicode\n", 'unicode retrieved OK'; my %handles = ( IN => $in, OUT => $out, ); for my $fh (keys %handles) { my @layers = PerlIO::get_layers($handles{$fh}); ok(grep(m/utf8/, @layers), "$fh: utf8 does appear in the perlio layers") or diag explain { $fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), "$fh: utf-?8[-_]strict does appear in the perlio layers") or diag explain { $fh => \@layers }; } lexical.t000644000000000000 131715133135367 14416 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # utf8::all should have lexical effect (except for @ARGV!) use Test::More tests => 4; my $expected_unicode = "\x{30c6}\x{30b9}\x{30c8}"; # Unicode characters my $expected_utf8 = "\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}"; # UTF-8 encoded octets is "テスト" => $expected_utf8, 'Literal string should be utf-8 encoded octets without utf8::all'; { use utf8::all; is "テスト" => $expected_unicode, 'Literal string should be characters under utf8::all'; } is "テスト" => $expected_utf8, 'Literal string should be utf-8 encoded octets without utf8::all (again)'; use utf8::all; is "テスト" => $expected_unicode, 'Literal string should be characters under utf8::all (again)'; no_global.t000644000000000000 362515133135367 14735 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that ust8::all with NO-GLOBAL does not change @ARGV, STDIN, STDOUT, STDERR use strict; use warnings; BEGIN { # String literals are still utf-8 encoded octets here! @ARGV = qw(føø bar bāz テスト); } use utf8::all 'NO-GLOBAL'; use PerlIO; use Test::More; SKIP: { # If we run with the Perl Unicode flag to automatically # convert the command-line arguments to unicode characters, # we need to skip this test skip 'Perl Unicode flag set to automatically convert command-line arguments', 1 if (${^UNICODE} & 32); # føø bar bāz テスト still as utf-8 encoded octets is_deeply \@ARGV => [ "\x{66}\x{c3}\x{b8}\x{c3}\x{b8}", "\x{62}\x{61}\x{72}", "\x{62}\x{c4}\x{81}\x{7a}", "\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}" ], '@ARGV as utf-8 octets'; } # Test the standard handles are NOT utf-8 my $utf8_flag = 1; for my $fh (*STDIN, *STDOUT, *STDERR) { my @layers = PerlIO::get_layers($fh); SKIP: { # If we have the Perl Unicode flag set that adds the UTF-8 layer, # we need to skip this test. skip 'Perl Unicode flag set that always adds UTF-8 layer', 1 if (${^UNICODE} & $utf8_flag); ok(!grep(/utf8/, @layers), q{utf8 does not appear in perlio layers}) or diag explain { $fh => \@layers }; } ok(!grep(m/utf-?8[-_]strict/, @layers), q{utf-?8[-_]strict does not appear in the perlio layers}) or diag explain { $fh => \@layers }; $utf8_flag *= 2; } ok((open my $test_fh, ">", "perlio_test"), 'open file for writing with utf8::all'); END { unlink "perlio_test" } my @layers = PerlIO::get_layers($test_fh); ok(grep(m/utf8/, @layers), 'utf8 appears in the perlio layers') or diag explain { $test_fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), 'utf-?8[-_]strict appears in the perlio layers') or diag explain { $test_fh => \@layers }; done_testing; open.t000644000000000000 77715133135367 13727 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test opening an actual file use utf8::all; use PerlIO; use Test::More tests => 4; ok open my $in, '<', 'corpus/testfile'; my @layers = PerlIO::get_layers($in); ok(grep(m/utf8/, @layers), 'utf8 appears in the perlio layers') or diag explain { $fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), 'utf-?8[-_]strict appears in the perlio layers') or diag explain { $fh => \@layers }; my $contents = do { local $/; <$in>}; is $contents, "\x{30c6}\x{30b9}\x{30c8}\n", 'unicode retrieved OK'; readdir.t000644000000000000 352115133135367 14406 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More 0.96; use Encode qw/decode FB_CROAK/; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; mkdir "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}" or die "Couldn't create directory corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}: $!" unless -d "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}"; plan tests => 3; subtest utf8 => sub { plan tests => 3; opendir my $dh, 'corpus' or die "Couldn't open directory 'corpus'"; my @files = sort grep { $_ ne '.' and $_ ne '..' } readdir $dh; my @utf8_files; { rewinddir $dh; use utf8::all; @utf8_files = sort grep { $_ ne '.' and $_ ne '..' } readdir $dh; } closedir $dh; is_deeply \@utf8_files, [sort "\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", "testfile"]; is $files[0] => $utf8_files[0]; isnt $files[1] => $utf8_files[1]; }; subtest context => sub { plan tests => 1; opendir my $dh, 'corpus' or die "Couldn't open directory 'corpus'"; use utf8::all; my $core = CORE::readdir $dh; rewinddir $dh; my $utf8 = readdir $dh; rewinddir $dh; is $utf8 => decode('UTF-8', $core, FB_CROAK) or diag "$utf8 : $core"; closedir $dh; }; subtest package_var => sub { plan tests => 3; opendir DH, 'corpus' or die "Couldn't open directory 'corpus'"; my @files = sort grep { $_ ne '.' and $_ ne '..' } eval { readdir DH; }; my @utf8_files; { rewinddir DH; use utf8::all; @utf8_files = sort grep { $_ ne '.' and $_ ne '..' } readdir DH; } closedir DH; is_deeply \@utf8_files, [sort "\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", "testfile"]; is $files[0] => $utf8_files[0]; is decode('UTF-8', $files[1], FB_CROAK) => $utf8_files[1]; }; readlink.t000644000000000000 224115133135367 14563 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More 0.96; use Encode qw/find_encoding FB_CROAK LEAVE_SRC/; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; mkdir "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}" or die "Couldn't create directory corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}: $!" unless -d "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}"; symlink "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", "testlink.tmp" or die "Couldn't create symlink from testlink.tmp: $!"; END { unlink("testlink.tmp") or die "Unable to remove testlink.tmp: $!" if -l "testlink.tmp"; } my $_UTF8 = find_encoding('UTF-8'); plan tests => 3; my $linkdest = readlink('testlink.tmp'); my $utf8_linkdest; { use utf8::all; $utf8_linkdest = readlink('testlink.tmp'); } is $utf8_linkdest => "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}", 'utf8 linkdest should be as expected'; is $linkdest => $_UTF8->encode($utf8_linkdest, FB_CROAK | LEAVE_SRC), 'encoded utf8 linkdest matches non-utf8'; is $_UTF8->decode($linkdest, FB_CROAK | LEAVE_SRC) => $utf8_linkdest, 'utf8 linkdest matches decoded non-utf8'; readpipe.t000644000000000000 327415133135367 14572 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More 0.96; use Encode qw/find_encoding FB_CROAK LEAVE_SRC/; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; mkdir "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}" or die "Couldn't create directory corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}: $!" unless -d "corpus/\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}"; my $_UTF8 = find_encoding('UTF-8'); plan tests => 3*3; my $cmd = 'ls -1 corpus'; my $expected = "testfile\n\x{307f}\x{304b}\x{3061}\x{3083}\x{3093}\n"; my $result; my $utf8_result; sub sort_res { return join("\n", sort(split("\n", shift))); } sub test_res { my $test = shift; my $result = shift; my $utf8_result = shift; is sort_res($utf8_result) => sort_res($expected), "$test utf8 result should be as expected"; SKIP: { # If we have the Perl Unicode flag set that adds the UTF-8 layer, # we need to skip these tests. skip 'Perl Unicode flag set that always adds UTF-8 layer to input', 2 if (${^UNICODE} & 8); is $result => $_UTF8->encode($utf8_result, FB_CROAK | LEAVE_SRC), "$test encoded utf8 result matches non-utf8"; is $_UTF8->decode($result, FB_CROAK | LEAVE_SRC) => $utf8_result, "$test utf8 result matches decoded non-utf8"; } } # readpipe $result = readpipe($cmd); { use utf8::all; $utf8_result = readpipe($cmd); } test_res('readpipe', $result, $utf8_result); # Backtick $result = `$cmd`; { use utf8::all; $utf8_result = `$cmd`; } test_res('Backtick', $result, $utf8_result); # qx $result = qx{$cmd}; { use utf8::all; $utf8_result = qx{$cmd}; } test_res('qx', $result, $utf8_result); threads.t000644000000000000 131215133135367 14422 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # Test that utf8::all is choosing the right encoding to not tickle # thread bugs. use strict; use warnings; # This is loaded before threads. It will not be aware of tests run in # a thread. use Test::More 0.96; use Config; BEGIN { plan skip_all => "Requires threads" if !$Config{usethreads}; plan skip_all => "Thread support on Perl <= v5.10.0 is unstable" if $^V <= v5.10.0; plan tests => 1; } # Deliberately before loading threads so we don't cheat and check # if threads are loaded, that would be brittle. use utf8::all; use threads; use threads::shared; my $ok :shared = 0; my $t = threads->create(sub { $ok = 1; }); $t->join(); ok $ok, "threads ok with utf8::all"; unicode_eval.t000644000000000000 134115133135367 15427 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # utf8::all should turn on feature qw(unicode_strings) use strict; use warnings; use Test::More; plan $^V >= v5.16.0 ? (tests => 5) : (skip_all => q/Can't enable unicode_eval on perl < 5.16.0/); # straight out of t/uni/eval.t use utf8::all; { my $w; $SIG{__WARN__} = sub { $w = shift }; use utf8; my $prog = "qq!\x{f9}!"; eval $prog; ok !$w; $w = ""; utf8::upgrade($prog); eval $prog; is $w, ''; } { use utf8; isnt eval "q!\360\237\220\252!", eval "q!\x{1f42a}!"; } { no utf8; #Let's make real sure. my $not_utf8 = "q!\343\203\213!"; isnt eval $not_utf8, eval "q!\x{30cb}!"; { use utf8; isnt eval $not_utf8, eval "q!\x{30cb}!"; } }unicode_strings.t000644000000000000 443515133135367 16200 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # utf8::all should turn on feature qw(unicode_strings) use strict; use warnings; use Config; use Test::More; plan $^V >= v5.14.0 ? (tests => 13) : (skip_all => q/character set modifiers aren't available until 5.14.0/); use constant HAVE_LOCALE => $Config{i_locale}; my $code = <<'TEST_CODE'; # Straight out of t/re/pat.t { # Test that charset modifier work, and are interpolated is(qr/\b\v$/, '(?^:\b\v$)', 'Verify no locale, no unicode_strings gives default modifier'); is(qr/(?l:\b\v$)/, '(?^:(?l:\b\v$))', 'Verify infix l modifier compiles'); is(qr/(?u:\b\v$)/, '(?^:(?u:\b\v$))', 'Verify infix u modifier compiles'); is(qr/(?l)\b\v$/, '(?^:(?l)\b\v$)', 'Verify (?l) compiles'); is(qr/(?u)\b\v$/, '(?^:(?u)\b\v$)', 'Verify (?u) compiles'); my $dual = qr/\b\v$/; use locale; my $locale = qr/\b\v$/; SKIP: { skip "No locale on this system, /l flag not present", 1 if !HAVE_LOCALE; is($locale, '(?^l:\b\v$)', 'Verify has l modifier when compiled under use locale'); } no locale; use utf8::all; # use utf8::all instead of feature qw(unicode_strings); my $unicode = qr/\b\v$/; is($unicode, '(?^u:\b\v$)', 'Verify has u modifier when compiled under unicode_strings'); is(qr/abc$dual/, '(?^u:abc(?^:\b\v$))', 'Verify retains d meaning when interpolated under locale'); SKIP: { skip "No locale on this system, /l flag not present", 1 if !HAVE_LOCALE; is(qr/abc$locale/, '(?^u:abc(?^l:\b\v$))', 'Verify retains l when interpolated under unicode_strings'); } no feature 'unicode_strings'; SKIP: { skip "No locale on this system, /l flag not present", 1 if !HAVE_LOCALE; is(qr/abc$locale/, '(?^:abc(?^l:\b\v$))', 'Verify retains l when interpolated outside locale and unicode strings'); } is(qr/def$unicode/, '(?^:def(?^u:\b\v$))', 'Verify retains u when interpolated outside locale and unicode strings'); use locale; SKIP: { skip "No locale on this system, /l flag not present", 2 if !HAVE_LOCALE; is(qr/abc$dual/, '(?^l:abc(?^:\b\v$))', 'Verify retains d meaning when interpolated under locale'); is(qr/abc$unicode/, '(?^l:abc(?^u:\b\v$))', 'Verify retains u when interpolated under locale'); } } TEST_CODE eval $code;utf8.t000644000000000000 303115133135367 13656 0ustar00rootroot000000000000utf8-all-0.026/t#!perl # utf8::all turns on utf8 use strict; use warnings; use PerlIO; use Test::More; # Test with it on { use utf8::all; is length "utf8::all is MËTÁŁ" => 18, 'unicode string is characters'; # Test the standard handles and all newly opened handles are utf8 ok((open my $test_fh, ">", "perlio_test"), 'open file for writing with utf8::all'); END { unlink "perlio_test" } for my $fh (*STDOUT, *STDIN, *STDERR, $test_fh) { my @layers = PerlIO::get_layers($fh); ok(grep(m/utf8/, @layers), 'utf8 appears in the perlio layers') or diag explain { $fh => \@layers }; ok(grep(m/utf-?8[-_]strict/, @layers), 'utf-?8[-_]strict appears in the perlio layers') or diag explain { $fh => \@layers }; } } # And off { is length "utf8::all is MËTÁŁ" => 21, 'unicode string is octets'; ok((open my $test_fh, ">", "perlio_test2"), 'open file for writing with utf8::all'); END { unlink "perlio_test2" } my @layers = PerlIO::get_layers($test_fh); SKIP: { # If we have the Perl Unicode flag set that adds the UTF-8 layer, # we need to skip this test. skip 'Perl Unicode flag set that always adds UTF-8 layer to output', 1 if (${^UNICODE} & 16); ok(!grep(/utf8/, @layers), q{utf8 does not appear in perlio layers}) or diag explain { $test_fh => \@layers }; } ok(!grep(m/utf-?8[-_]strict/, @layers), q{utf-?8[-_]strict does not appear in the perlio layers}) or diag explain { $test_fh => \@layers }; } done_testing; utf8_check.t000644000000000000 334015133135367 15016 0ustar00rootroot000000000000utf8-all-0.026/t#!perl use strict; use warnings; use Test::More; use Test::Warn; use Test::Exception; plan skip_all => "$^O does not have proper utf-8 file system support" if $^O =~ /MSWin32|cygwin|dos|os2/; plan tests => 6; # Tests if setting $utf8::all::UTF8_CHECK has the required result use Encode (); use utf8::all; no warnings FATAL => 'utf8'; # disable fatal utf8 warnings # String with an illegal Unicode character my $faulty_string = "Illegal \x{d800} character"; # Warn on faulty utf-8 { local $utf8::all::UTF8_CHECK = Encode::FB_WARN; Test::Warn::warning_like { glob($faulty_string); } qr/"\\x\{d800\}" does not map to (utf8|UTF-8)/, 'warn on encoding error: glob'; Test::Warn::warning_like { readlink($faulty_string); } qr/"\\x\{d800\}" does not map to (utf8|UTF-8)/, 'warn on encoding error: readlink'; } # Croak on faulty utf-8 { Test::Exception::throws_ok { glob($faulty_string); } qr/"\\x\{d800\}" does not map to (utf8|UTF-8)/, 'croak on encoding error (default): glob'; Test::Exception::throws_ok { readlink($faulty_string); } qr/"\\x\{d800\}" does not map to (utf8|UTF-8)/, 'croak on encoding error (default): readlink'; } # Nothing on faulty utf-8 { local $utf8::all::UTF8_CHECK = Encode::FB_DEFAULT; Test::Warn::warning_is { glob($faulty_string); } [], 'no warn on encoding error: glob'; Test::Warn::warning_is { readlink($faulty_string); } [], 'no warn on encoding error: readlink'; } xt000755000000000000 015133135367 12637 5ustar00rootroot000000000000utf8-all-0.026author000755000000000000 015133135367 14141 5ustar00rootroot000000000000utf8-all-0.026/xtcritic.t000644000000000000 11415133135367 15716 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl use strict; use warnings; use Test::Perl::Critic; all_critic_ok(); distmeta.t000644000000000000 22315133135367 16254 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use strict; use warnings; use Test::CPAN::Meta; meta_yaml_ok(); eol.t000644000000000000 132215133135367 15242 0ustar00rootroot000000000000utf8-all-0.026/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/utf8/all.pm', 't/00-compile.t', 't/ARGV.t', 't/ARGV_nonmain.t', 't/ARGV_twice.t', 't/FATAL_utf8.t', 't/autodie.t', 't/charnames.t', 't/fc.t', 't/force_global.t', 't/glob.t', 't/global_nonmain.t', 't/lexical-again.t', 't/lexical.t', 't/no_global.t', 't/open.t', 't/readdir.t', 't/readlink.t', 't/readpipe.t', 't/threads.t', 't/unicode_eval.t', 't/unicode_strings.t', 't/utf8.t', 't/utf8_check.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; minimum-version.t000644000000000000 15215133135367 17601 0ustar00rootroot000000000000utf8-all-0.026/xt/authoruse strict; use warnings; use Test::More; use Test::MinimumVersion; all_minimum_version_ok( qq{5.010} ); mojibake.t000644000000000000 15115133135367 16223 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); no-tabs.t000644000000000000 127015133135367 16030 0ustar00rootroot000000000000utf8-all-0.026/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/utf8/all.pm', 't/00-compile.t', 't/ARGV.t', 't/ARGV_nonmain.t', 't/ARGV_twice.t', 't/FATAL_utf8.t', 't/autodie.t', 't/charnames.t', 't/fc.t', 't/force_global.t', 't/glob.t', 't/global_nonmain.t', 't/lexical-again.t', 't/lexical.t', 't/no_global.t', 't/open.t', 't/readdir.t', 't/readlink.t', 't/readpipe.t', 't/threads.t', 't/unicode_eval.t', 't/unicode_strings.t', 't/utf8.t', 't/utf8_check.t' ); notabs_ok($_) foreach @files; done_testing; pod-coverage.t000644000000000000 36515133135367 17024 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use strict; use warnings; use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); pod-linkcheck.t000644000000000000 64115133135367 17161 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl use strict; use warnings; use Test::More; foreach my $env_skip ( qw(SKIP_POD_LINKCHECK) ) { plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { my $linktest = Test::Pod::LinkCheck->new; $linktest->cpan_backend('CPAN'); $linktest->all_pod_ok; } pod-syntax.t000644000000000000 25215133135367 16552 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); portability.t000644000000000000 13015133135367 17001 0ustar00rootroot000000000000utf8-all-0.026/xt/authoruse strict; use warnings; use Test::More; use Test::Portability::Files; run_tests(); synopsis.t000644000000000000 6015133135367 16310 0ustar00rootroot000000000000utf8-all-0.026/xt/author#!perl use Test::Synopsis; all_synopsis_ok(); test-version.t000644000000000000 63715133135367 17115 0ustar00rootroot000000000000utf8-all-0.026/xt/authoruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; release000755000000000000 015133135367 14257 5ustar00rootroot000000000000utf8-all-0.026/xtcpan-changes.t000644000000000000 34415133135367 17113 0ustar00rootroot000000000000utf8-all-0.026/xt/releaseuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.013 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; dist-manifest.t000644000000000000 12215133135367 17325 0ustar00rootroot000000000000utf8-all-0.026/xt/releaseuse strict; use warnings; use Test::More; use Test::DistManifest; manifest_ok(); kwalitee.t000644000000000000 27515133135367 16374 0ustar00rootroot000000000000utf8-all-0.026/xt/release# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.13 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok(); done_testing; meta-json.t000644000000000000 6415133135367 16440 0ustar00rootroot000000000000utf8-all-0.026/xt/release#!perl use Test::CPAN::Meta::JSON; meta_json_ok(); unused-vars.t000644000000000000 14215133135367 17034 0ustar00rootroot000000000000utf8-all-0.026/xt/releaseuse Test::More 0.96 tests => 1; use Test::Vars; subtest 'unused vars' => sub { all_vars_ok(); };