How do I set LC_ALL and LANG in IIS?

I am trying to run some Perl CGI scripts in IIS. I receive the following message:


CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LC_ALL = (unset),
    LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

      

I figured out that the problem only occurs when I "use" the internal library, but it's really big (using a lot of other things), so I'd rather know where to look. When I run the same script from the command line, the script works just fine. I tried to set "LANG" to "C", then "LC_ALL" to "C", but it had no effect.

Any pointers are appreciated!

+1


source to share


4 answers


The LANG and LC_ALL environment variables are set for your shell, but they are not set for IIS. I'm not an IIS person, but the docs say that IIS is a service and you have to install them ahead of time and then reboot.

Alternatively, you can set these variables as soon as your script starts compiling (and before loading a large library that is causing problems:

BEGIN {
 $ ENV {LC_ALL} = ...;
 $ ENV {LANG} = ...;
 }


Get the values ​​you should be using by looking at the ones you have in your shell.

Good luck,

+2


source


Your Perl application seems to be sending errors to it in the browser and an error occurs before sending the header.

If you are using a CGI module, the first one can be called use CGI::CARP qw(fatalsToBrowser)

.



In this case, it fatalsToBrowser

does more harm than you need it, so I would advise you to disable it now.

0


source


perldoc for locale can help you. It even contains a troubleshooting section.

0


source


You can suppress this error by setting PERL_BADLANG = 0, although like LC_ALL it must be set before running the Perl script.

0


source







All Articles