Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 81255
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc: perl5-porters [...] perl.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: perl5-porters [...] perl.org
Subject: [PATCH] Deprecate encoding.pm
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1353223172-1102-2"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 645
Download (untitled) / with headers
text/plain 645b
We would like to deprecate and remove the perl core support for encoding.pm, for several reasons: • The implementation is quite pervasive, making it harder to fix bugs in perl without breaking encoding.pm. • The implementation is already full of bugs, and nobody is fixing them. • Any time someone brings it up on p5p, the general consensus is that one should avoid using encoding.pm. • Even if we could fix the bugs, it still breaks Perl’s string model. "\x{ff}\x{100}" does not give me characters 255 and 256. In fact, there is no way for me to get Unicode character 255 under latin 2. Please consider the attached patch.
Subject: open_EZcaR7Oj.txt
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"; name="open_EZcaR7Oj.txt"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="open_EZcaR7Oj.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
Content-Length: 819
Download open_EZcaR7Oj.txt
text/plain 819b
diff -rup Encode-2.47-oaTvCA/encoding.pm Encode-2.47-0dOOqx/encoding.pm --- Encode-2.47-oaTvCA/encoding.pm 2012-11-17 23:16:46.000000000 -0800 +++ Encode-2.47-0dOOqx/encoding.pm 2012-11-17 23:16:44.000000000 -0800 @@ -102,6 +102,10 @@ sub _get_locale_encoding { } sub import { + if ($] >= 5.017) { + warnings::warnif("deprecated", + "Use of the encoding pragma is deprecated") + } my $class = shift; my $name = shift; if (!$name){ @@ -203,6 +207,12 @@ __END__ encoding - allows you to write your script in non-ascii or non-utf8 +=head1 WARNING + +This module is deprecated under perl 5.18. It uses a mechanism provided by +perl that is deprecated under 5.18 and higher, and may be removed in a +future version. + =head1 SYNOPSIS use encoding "greek"; # Perl like Greek to you?
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: multipart/mixed; boundary="----------=_1353224340-8748-2"
Message-ID: <rt-3.8.HEAD-8748-1353224340-1633.81255-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 787
Download (untitled) / with headers
text/plain 787b
On Sun Nov 18 02:19:32 2012, SPROUT wrote: Show quoted text
> We would like to deprecate and remove the perl core support for > encoding.pm, for several reasons: > > • The implementation is quite pervasive, making it harder to fix bugs > in perl without breaking encoding.pm. > • The implementation is already full of bugs, and nobody is fixing them. > • Any time someone brings it up on p5p, the general consensus is that > one should avoid using encoding.pm. > • Even if we could fix the bugs, it still breaks Perl’s string model. > "\x{ff}\x{100}" does not give me characters 255 and 256. In fact, > there is no way for me to get Unicode character 255 under latin 2. > > Please consider the attached patch.
Here is a better patch that suppressing the warnings in the test suite.
MIME-Version: 1.0
Subject: better patch.txt
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain; charset="utf-8"; name="better patch.txt"
Content-Disposition: inline; filename="better patch.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 3614
Download better patch.txt
text/plain 3.5k
diff -rup Encode-2.47-oaTvCA/encoding.pm Encode-2.47-0dOOqx/encoding.pm --- Encode-2.47-oaTvCA/encoding.pm 2012-11-17 23:16:46.000000000 -0800 +++ Encode-2.47-0dOOqx/encoding.pm 2012-11-17 23:16:44.000000000 -0800 @@ -102,6 +102,10 @@ sub _get_locale_encoding { } sub import { + if ($] >= 5.017) { + warnings::warnif("deprecated", + "Use of the encoding pragma is deprecated") + } my $class = shift; my $name = shift; if (!$name){ @@ -203,6 +207,12 @@ __END__ encoding - allows you to write your script in non-ascii or non-utf8 +=head1 WARNING + +This module is deprecated under perl 5.18. It uses a mechanism provided by +perl that is deprecated under 5.18 and higher, and may be removed in a +future version. + =head1 SYNOPSIS use encoding "greek"; # Perl like Greek to you? diff -rup Encode-2.47-oaTvCA/t/Mod_EUCJP.pm Encode-2.47-0dOOqx/t/Mod_EUCJP.pm --- Encode-2.47-oaTvCA/t/Mod_EUCJP.pm 2012-08-14 22:36:25.000000000 -0700 +++ Encode-2.47-0dOOqx/t/Mod_EUCJP.pm 2012-11-17 23:31:42.000000000 -0800 @@ -1,6 +1,7 @@ # $Id: Mod_EUCJP.pm,v 2.0 2004/05/16 20:55:17 dankogai Exp $ # This file is in euc-jp package Mod_EUCJP; +no warnings "deprecated"; use encoding "euc-jp"; sub new { my $class = shift; diff -rup Encode-2.47-oaTvCA/t/enc_data.t Encode-2.47-0dOOqx/t/enc_data.t --- Encode-2.47-oaTvCA/t/enc_data.t 2012-08-14 22:36:17.000000000 -0700 +++ Encode-2.47-0dOOqx/t/enc_data.t 2012-11-17 23:27:38.000000000 -0800 @@ -22,6 +22,7 @@ BEGIN { use strict; +no warnings "deprecated"; use encoding 'euc-jp'; use Test::More tests => 4; diff -rup Encode-2.47-oaTvCA/t/enc_eucjp.t Encode-2.47-0dOOqx/t/enc_eucjp.t --- Encode-2.47-oaTvCA/t/enc_eucjp.t 2012-08-14 22:36:17.000000000 -0700 +++ Encode-2.47-0dOOqx/t/enc_eucjp.t 2012-11-17 23:28:33.000000000 -0800 @@ -21,6 +21,7 @@ BEGIN { } } +no warnings "deprecated"; use encoding 'euc-jp'; my @c = (127, 128, 255, 256); diff -rup Encode-2.47-oaTvCA/t/enc_module.t Encode-2.47-0dOOqx/t/enc_module.t --- Encode-2.47-oaTvCA/t/enc_module.t 2012-08-14 22:36:23.000000000 -0700 +++ Encode-2.47-0dOOqx/t/enc_module.t 2012-11-17 23:29:01.000000000 -0800 @@ -21,6 +21,7 @@ BEGIN { } use lib qw(t ext/Encode/t ../ext/Encode/t); # latter 2 for perl core use Mod_EUCJP; +no warnings "deprecated"; use encoding "euc-jp"; use Test::More tests => 3; use File::Basename; diff -rup Encode-2.47-oaTvCA/t/enc_utf8.t Encode-2.47-0dOOqx/t/enc_utf8.t --- Encode-2.47-oaTvCA/t/enc_utf8.t 2012-08-14 22:36:17.000000000 -0700 +++ Encode-2.47-0dOOqx/t/enc_utf8.t 2012-11-17 23:29:16.000000000 -0800 @@ -17,6 +17,7 @@ BEGIN { } } +no warnings "deprecated"; use encoding 'utf8'; my @c = (127, 128, 255, 256); diff -rup Encode-2.47-oaTvCA/t/encoding.t Encode-2.47-0dOOqx/t/encoding.t --- Encode-2.47-oaTvCA/t/encoding.t 2009-09-07 07:57:26.000000000 -0700 +++ Encode-2.47-0dOOqx/t/encoding.t 2012-11-17 23:29:37.000000000 -0800 @@ -16,6 +16,7 @@ BEGIN { print "1..31\n"; +no warnings "deprecated"; use encoding "latin1"; # ignored (overwritten by the next line) use encoding "greek"; # iso 8859-7 (no "latin" alias, surprise...) diff -rup Encode-2.47-oaTvCA/t/jperl.t Encode-2.47-0dOOqx/t/jperl.t --- Encode-2.47-oaTvCA/t/jperl.t 2012-08-14 22:36:23.000000000 -0700 +++ Encode-2.47-0dOOqx/t/jperl.t 2012-11-17 23:29:59.000000000 -0800 @@ -27,6 +27,7 @@ use strict; use Test::More tests => 15; # black magic tests commented out my $Debug = shift; +no warnings "deprecated"; no encoding; # ensure my $Enamae = "\xbe\xae\xbb\xf4\x20\xc3\xc6"; # euc-jp, with \x escapes use encoding "euc-jp";
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-8748-1353224340-1633.81255-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <rt-3.8.HEAD-8748-1353224340-1633.81255-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-9307-1361152971-788.81255-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 929
Download (untitled) / with headers
text/plain 929b
Thank you. "Better Patch" applied. Dan the Maintainer Thereof On Sun Nov 18 02:39:00 2012, SPROUT wrote: Show quoted text
> On Sun Nov 18 02:19:32 2012, SPROUT wrote:
> > We would like to deprecate and remove the perl core support for > > encoding.pm, for several reasons: > > > > • The implementation is quite pervasive, making it harder to fix bugs > > in perl without breaking encoding.pm. > > • The implementation is already full of bugs, and nobody is fixing them. > > • Any time someone brings it up on p5p, the general consensus is that > > one should avoid using encoding.pm. > > • Even if we could fix the bugs, it still breaks Perl’s string model. > > "\x{ff}\x{100}" does not give me characters 255 and 256. In fact, > > there is no way for me to get Unicode character 255 under latin 2. > > > > Please consider the attached patch.
> > Here is a better patch that suppressing the warnings in the test suite.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-31794-1361153066-622.81255-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 71
I forgot to change the status. Excuse me. Dan the Maintainer Thereof


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.