<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — LC_ALL locale issue fills up tmp/errors.log file]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5204</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5204&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in LC_ALL locale issue fills up tmp/errors.log file.]]></description>
		<lastBuildDate>Thu, 25 Sep 2014 20:24:01 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: LC_ALL locale issue fills up tmp/errors.log file]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=20983#p20983</link>
			<description><![CDATA[<p>A reboot of the Debian machine now shows:<br /></p><div class="codebox"><pre><code># locale
LANG=
LANGUAGE=
LC_CTYPE=&quot;POSIX&quot;
LC_NUMERIC=&quot;POSIX&quot;
LC_TIME=&quot;POSIX&quot;
LC_COLLATE=&quot;POSIX&quot;
LC_MONETARY=&quot;POSIX&quot;
LC_MESSAGES=&quot;POSIX&quot;
LC_PAPER=&quot;POSIX&quot;
LC_NAME=&quot;POSIX&quot;
LC_ADDRESS=&quot;POSIX&quot;
LC_TELEPHONE=&quot;POSIX&quot;
LC_MEASUREMENT=&quot;POSIX&quot;
LC_IDENTIFICATION=&quot;POSIX&quot;
LC_ALL=</code></pre></div><p>And all works well!</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 25 Sep 2014 20:24:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=20983#p20983</guid>
		</item>
		<item>
			<title><![CDATA[LC_ALL locale issue fills up tmp/errors.log file]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=20982#p20982</link>
			<description><![CDATA[<p>By default a Debian System has the locale as &quot;C&quot; and the output of <strong>locale</strong> bash command is:<br /></p><div class="codebox"><pre><code># locale
LANG=C
LANGUAGE=
LC_CTYPE=&quot;C&quot;
LC_NUMERIC=&quot;C&quot;
LC_TIME=&quot;C&quot;
LC_COLLATE=&quot;C&quot;
LC_MONETARY=&quot;C&quot;
LC_MESSAGES=&quot;C&quot;
LC_PAPER=&quot;C&quot;
LC_NAME=&quot;C&quot;
LC_ADDRESS=&quot;C&quot;
LC_TELEPHONE=&quot;C&quot;
LC_MEASUREMENT=&quot;C&quot;
LC_IDENTIFICATION=&quot;C&quot;
LC_ALL=</code></pre></div><p>This means that when testing for LC_ALL we will always get it as false in the <strong>includes/lang/gettext.php</strong>:<br /></p><div class="codebox"><pre><code>    function set_language($lang_code, $encoding)
    {
        putenv(&quot;LANG=$lang_code&quot;);
        putenv(&quot;LC_ALL=$lang_code&quot;);
        putenv(&quot;LANGUAGE=$lang_code&quot;);

        //$set = setlocale(LC_ALL, &quot;$lang_code&quot;);
        //$set = setlocale(LC_ALL, &quot;$encoding&quot;);

        // cover a couple of country/encoding variants 
        $up = strtoupper($encoding);
        $low = strtolower($encoding);
        $lshort = strtr($up, &#039;-&#039;,&#039;&#039;);
        $ushort = strtr($low, &#039;-&#039;,&#039;&#039;);

        if ($lang_code == &#039;C&#039;)
            $set = setlocale(LC_ALL,&#039;C&#039;);
        else
            $set = setlocale(LC_ALL, $lang_code.&quot;.&quot;.$encoding, 
                $lang_code.&quot;.&quot;.$up, $lang_code.&quot;.&quot;.$low,
                $lang_code.&quot;.&quot;.$ushort,    $lang_code.&quot;.&quot;.$lshort);

        setlocale(LC_NUMERIC, &#039;C&#039;); // important for numeric presentation etc.
        if ($set === false) 
        {
            if (strtoupper(substr(PHP_OS, 0, 3)) === &#039;WIN&#039;) // don&#039;t do this test if server is WIN
                return 0;
            $str = sprintf(&#039;language code &quot;%s&quot;, encoding &quot;%s&quot; not supported by your system&#039;,
                $lang_code, $encoding);
            //$err = new GetText_Error($str);
            //return PEAR::raise_error($err);
            return raise_error(&quot;1 &quot; . $str);
        }
        //return 0;
    }</code></pre></div><p>This raises the error in <strong>tmp/errors.log</strong> each time the FA scripts are executed:<br /></p><div class="codebox"><pre><code>[26-Sep-2014 00:44:58] 1 language code &quot;en_US&quot;, encoding &quot;iso-8859-1&quot; not supported by your system</code></pre></div><p>Commands tried to no avail:<br />&nbsp; locale<br />&nbsp; locale-gen<br />&nbsp; locale-gen en_US<br />&nbsp; dpkg-reconfigure locales</p><p>Contents of <strong>installed_languages.inc</strong>:<br /></p><div class="codebox"><pre><code>$installed_languages = array (
  0 =&gt; 
  array (
    &#039;code&#039; =&gt; &#039;C&#039;,
    &#039;name&#039; =&gt; &#039;English&#039;,
    &#039;encoding&#039; =&gt; &#039;iso-8859-1&#039;,
  ),
  1 =&gt; 
  array (
    &#039;code&#039; =&gt; &#039;en_US&#039;,
    &#039;name&#039; =&gt; &#039;English US&#039;,
    &#039;encoding&#039; =&gt; &#039;iso-8859-1&#039;,
    &#039;path&#039; =&gt; &#039;lang/en_US&#039;,
  ),
);

$dflt_lang = &#039;C&#039;;</code></pre></div><p><strong>lang/en_US/LC_MESSAGES/en_US.mo</strong> exists.</p><p>Possible solution link:<br />http://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html</p><p>where it is suggested to make it:<br /></p><div class="codebox"><pre><code>        if ($lang_code == &#039;C&#039;)
            $set = setlocale(LC_ALL,&#039;&#039;);
        else
..
..</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 25 Sep 2014 19:50:15 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=20982#p20982</guid>
		</item>
	</channel>
</rss>
