[mythtv] Help needed for RPM Fusion package modernizaton

Michael T. Dean mtdean at thirdcontact.com
Mon Jul 30 18:36:49 UTC 2012


On 07/18/2012 02:03 PM, Bill Meek wrote:
> On 07/18/2012 10:04 AM, Stuart Morgan wrote:
>> On Wednesday 18 Jul 2012 09:36:01 Bill Meek wrote:
> ...
>>> Set LANG if it isn't already. For example: LANG=en_US.UTF-8.
>>
>> Making sure that it's actually correct for that machine/user and not 
>> en_US for
>> everyone.
>>
>> That said we don't actually need LANG for locale, it's just used as a 
>> hint, we
>> still ask users to confirm their language/country - entering these 
>> incorrectly
>> will result in the wrong settings being used by default.

We need to ensure that Qt properly "self-configures" its character 
encoding support.  To do this, we suggest specifying LC_ALL or LC_CTYPE 
/and/ LANG environment variables that are used by Qt to determine the 
system's character encoding stuff.  So, this is completely unrelated to 
the locale-support code in MythTV, but necessary for proper character 
encoding/multi-byte character support.

>
> I use: test -f /etc/default/locale && . /etc/default/locale || true
> to set it properly LANG in the Upstart .conf file.
>
> In any case, I always set LANG to remove the info & warning messages
> in the backend (and frontend) log:
>
>   I [1329/1329] CoreContext mythcorecontext.cpp:231 (Init) - Assumed 
> character encoding:
>   W [1329/1329] CoreContext mythcorecontext.cpp:238 (Init) - This 
> application expects to be running a locale that specifies a UTF-8 
> codeset, and many features may behave improperly with your current 
> language settings. Please set the LC_ALL or LC_CTYPE, and LANG 
> variable(s) in the environment in which this program is executed to 
> include a UTF-8 codeset (such as 'en_US.UTF-8').
>
> The above from: v0.26-pre-906-gb66f0cf, I updated the Upstart Wiki 
> while on 0.25pre.
>
> Or I have something configured wrong, or the messages don't need to be 
> there
> anymore or ???

Note "LC_ALL or LC_CTYPE, and LANG variable(s)".  It doesn't say "LC_ALL 
or LC_CTYPE or LANG variable(s)".  That means you should specify either 
LC_ALL or at least LC_CTYPE in addition to LANG.  Specifying them is 
definitely correct.  (Though for generic package-installed startup 
scripts, you should probably leverage the distro's configuration files, 
i.e. an /etc/sysconfig/i18n or /etc/sysconfig/lang or ... to make sure 
you get the right configuration, and it changes when the user 
reconfigures the distro.  Granted, you'll need to verify any codeset 
information that may be specified in those files, possibly replacing it 
with UTF-8, which is what you'll need with MythTV.)

The reason you have to do this is because there's no standard way to 
specify the character encoding mechanism, so different systems 
(different platforms and even different distros) use different 
mechanisms.  Therefore, Qt has a terrible, ugly hack that checks all 
sorts of things and makes a best guess.  While there are many ways you 
could trick it into doing the right thing, the easiest way to ensure Qt 
does the right thing is to explicitly specify the desired configuration 
in Qt's "most-preferred" approaches.  So, a distro-specific start script 
can provide some code to adapt the information in the distro's 
configuration files for use by Qt.

Mike


More information about the mythtv-dev mailing list