Re: pack('C'...) sets UTF8 flag

[email protected] ("Bob Hallissy")
Newsgroups perl.unicode
Message-ID <OFC7546CFC.AF170390-ON80257038.003E5907-80257038.004306DC@notes.sil.org>
On 2005-07-07 06:27:04 PM Rafael Garcia-Suarez wrote:

>This is fixed in the development branch of perl (5.9.x).
>Something probably goes wrong with the localisation of UTF-8 magic.
>The next 5.8.x release may have this bug fixed.

OK,  I've crafted the following module that seems to work as a patch. If 
anyone sees any problems with this please let me know!

package FixPack;
use strict;

use Encode qw(_utf8_off);

BEGIN {
*CORE::GLOBAL::pack = sub {
        my $pattern = shift;
        my $res = CORE::pack ($pattern, @_);
        _utf8_off($res) if $pattern =~ /^C/;
        $res;
        };
}
1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.