in reply to Encode module, wide character

I'd be grateful if you could include a minimal example of code that shows this behavior. I'm in an environment where different OS's on the local network are using 5.8.0, 5.8.1 and 5.8.5; if we haven't seen this "wide character in subroutine entry" warning yet, we probably will soon... There's a chance that it might not have anything to do with enabling wide characters on file handles (since the message doesn't mention file handles or i/o).

But after all, it is just a warning, and Perl is most likely doing "The Right Thing", despite complaining about it. This sort of warning about wide characters is Perl's way of saying "if you weren't already aware of this condition, you probably should be, just in case it might alter some assumptions you may have been making about your data..."

Replies are listed 'Best First'.
Re^2: Encode module, wide character
by Hank (Initiate) on Feb 08, 2005 at 01:20 UTC

    Interestingly the script works fine with ActiveStates's 5.8.1 build (no warnings whatsoever), so AFAIK the problem is limited to the Linux build on the production server. Note that the latter does not merely throw the typical "wide character" warnings -- the script terminates with error (see below) even if the "no warnings" pramata is issued.

    Since I am hardpressed to come up with a working minimal code, below is some pseudocode.

    use LWP::UserAgent; use HTML::Parser; use Encode; # Grab a HTML document from the Net. # Extract links from HTML document (legacy encoding, in this case Big5 +). # Decode linked strings # In my original post I used from_to($linktext, big5, utf-8)'s # in-place conversion. Same error, though. $linktext = decode( 'big5-eten', $linktext, Encode::FB_HTMLCREF ); # Test linked texts against a list of strings #Loop of linked texts foreach ( @keywords ) { local $_ = decode('utf-8', $_); # Force utf-8 flag if ( $linktext =~ /$_/ ) { # Do something } } # Typically the initial iterations appear OK but the loop never comple +tes # before the Wide Character error shows up. # End of loop

    I'm at a loss as to why the two 5.8.1 builds would behave differently even as 5.8.0 and 5.8.6 work. I also have no idea whether a workaround is possible.