Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: erroneous warning involving locale and input encoding: perl bug?

by Anonymous Monk
on Apr 17, 2017 at 21:02 UTC ( [id://1188167]=note: print w/replies, xml ) Need Help??


in reply to erroneous warning involving locale and input encoding: perl bug?

U+FFFD is the substitution character (this one: �). Probably generated by perl when it tried to decode your string and failed.

What's the output of locale -a? (your locale seems a bit wrong to me...)

  • Comment on Re: erroneous warning involving locale and input encoding: perl bug?
  • Download Code

Replies are listed 'Best First'.
Re^2: erroneous warning involving locale and input encoding: perl bug?
by raygun (Scribe) on Apr 17, 2017 at 23:23 UTC

    My code is designed to not care how the system locale is set: it explicitly says it will use only the ctype category, and then explicitly sets that category to ISO-8859-1, so that the locale settings of the shell are overruled.

    What do you think might be wrong with my setlocale() call? locale -a outputs

    C POSIX en_US en_US.iso88591 en_US.utf8
    The warning still appears even if I give setlocale() its lowest-common-denominator setting, 'C', instead of 'en_US.iso88591'.
      What do you think might be wrong with my setlocale() call?
      I see now that it should be ok.

      I don't think that your code should trigger any situation where perl could legimitely generate replacement character (if the input is as you say). Must be a bug.

        Thank you for the feedback. Before reporting it, I'll wait a bit to see if anyone with access to a later perl release can determine whether still happens there.

        Does anyone know a way to suppress this warning while allowing any others to still be displayed? My code trips on several regular expressions, some of which occur inside loops, so I'm getting a lot of noise on the screen. I could have the shell filter stderr, but maybe there's a painless way to control perl warnings with this kind of granularity?

        Update: I see that the no warnings 'locale' pragma will silence this warning... but also probably others that I want to see. I reckon there's no way to silence just that specific warning. At least this will get the job done until the underlying bug is fixed.

Re^2: erroneous warning involving locale and input encoding: perl bug?
by Anonymous Monk on Apr 17, 2017 at 21:04 UTC
    Probably generated by perl when it tried to decode your string and failed
    (although I don't see why...)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-26 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found