Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: String assignment oddity

by writch (Sexton)
on Apr 17, 2018 at 15:19 UTC ( #1213067=note: print w/replies, xml ) Need Help??

in reply to String assignment oddity

Ok, I have found the fix. I'm not sure I understand what is going on under the hood, but the fix is to use the Encode library and instead of assigning it directly as such:

$x = "files/$state/$type/thing.pdf"

I use the results of encode to assign it instead:

$x = encode('UTF-8', "files/$state/$type/thing.pdf", Encode::FB_CROAK);

Tracing through the CAM::PDF code showed the data in the success path was looking like straight hex (AFDDECBB), while in the failure path it was showing as such: (\x{af}\x{dd}\x{ec}\x{bb}).

Humans can't see any difference between $x, but perl sees something really different.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1213067]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2020-10-25 06:24 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.