The Problem - Rendering Unicode Characters using Glabels
I have a Perl script running on an Apache webserver that launches glabels-3-batch
and given a data input file and a glabels template outputs a label as a PDF document.
This is in a Ubuntu 18.04.1 LTS container running on Docker Community Edition on my MacBook Pro
The problem is that I have been using a $Latex \beta $ (beta) character in the file and when running from the command line with a UTF-8 language configured (en_AU.UTF-8) it works fine...

But from a web server, which is running as the www-data
user the line with the $Latex \beta $ (beta) value in it is missing...

I've traced the problem to not having a LANG environment variable specified in the environment that the www-data user is running under.
What doesn't work
I tried adding
PerlSetEnv LANG en_AU.UTF-8
to /etc/apache/apache2.conf
I also tried adding
export LANG=en_AU.UTF-8
to /etc/apache/envars
But both of the above didn't add the LANG setting to the environment
The Fix
To test the environment I used this script placed at cgi-bin/vars.pl
What worked was adding
SetEnv LANG en_AU.UTF-8
to /etc/apache/apache2.conf
Viewing your mod_perl / CGI Environment
1234567891011 <span class=
"hljs-comment"
>
#!/usr/bin/perl -wT</span>
<span class=
"hljs-keyword"
>
use
</span> strict;
<span class=
"hljs-keyword"
>
use
</span> CGI <span class=
"hljs-string"
>
qw(:standard)
</span>;
<span class=
"hljs-keyword"
>
use
</span> CGI::Carp <span class=
"hljs-string"
>
qw(warningsToBrowser fatalsToBrowser)
</span>;
<span class=
"hljs-keyword"
>
print
</span> header;
<span class=
"hljs-keyword"
>
print
</span> start_html(
&
;amp;quot;Environment
&
;amp;quot;);
<span class=
"hljs-keyword"
>
foreach
</span> <span class=
"hljs-keyword"
>
my
</span>
$key
(<span class=
"hljs-keyword"
>
sort
</span>(<span class=
"hljs-keyword"
>
keys
</span>(
%ENV
))) {
<span class=
"hljs-keyword"
>
print
</span>
&
;amp;quot;
$key
=
$ENV
{
$key
}
&
;amp;amp;<span class=
"hljs-keyword"
>lt</span>;br
&
;amp;<span class=
"hljs-keyword"
>gt</span>;\n
&
;amp;quot;;
}
0 Comments