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.
In reply to Re^2: Encode module, wide character
by Hank
in thread Encode module, wide character
by Hank
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |