wacom-hid-descriptors icon indicating copy to clipboard operation
wacom-hid-descriptors copied to clipboard

force LANG=C on fprint to ensure dot as decimal-sparator

Open Blaimi opened this issue 4 years ago • 6 comments

ran into this when using the script on a german localed fedora which is using , as decimal separator.

Blaimi avatar Jan 21 '21 17:01 Blaimi

Agree with whot. Should definitely apply to the whole script to be safe :)

jigpu avatar Jan 25 '21 15:01 jigpu

In that case, potential error messages would also be in C instead of the one from the user. another problem is the encoding. If it is applied on the whole script, C.utf8 should be used—but works only in utf8-environments then.

Blaimi avatar Jan 25 '21 16:01 Blaimi

The script itself is not multilingual: status updates, errors, and documentation are all in English. I'm not that concerned with keeping subprocesses multilingual. The sysinfo script uses LC_ALL=C and we haven't any any language or encoding complaints to speak of.

Comparing LC_ALL and LANG, the former seems like the better option since the latter is still subject to user-specific overrides that we're trying to avoid. Also, the docs indicate that we might be able to set both LC_ALL=C and LANGUAGE=$LANG to get a mix of both worlds: C-locale semantics with non-English messages. That combination isn't going to be perfect, but maybe closer to your ideal?

jigpu avatar Jan 25 '21 17:01 jigpu

Oh, I don't have an ideal :smile:. I only try to point out the pros and cons :wink:. The script could also set LC_NUMERIC for this specific problem. You won't get a perfect solution in any way. A „perfect“ solution would be that everything works in the locale (i.e. $PEN_DATA contains localized values) or normalized (i.e. fprint accepts dot even on de_DE).

My two cents: Playing with mixed locale-environments is always the same f***up like when working with unnormalized, different timezones. LANG is indeed not a good solution, the script should either LC_NUMERIC=C for the single fprint-commands or set a LC_ALL in the header. for LC_ALL I'd use en_US.utf8 instead of C.

What do you want? :smiley:

Blaimi avatar Jan 25 '21 17:01 Blaimi

I agree with @Blaimi, mixing two locales is bound to cause more issues. Let's force LC_ALL=C and let's see if anyone complains. As for C.utf8 I'm not sure I have enough opinion here, does it matter for what we're doing here?

whot avatar Jan 29 '21 05:01 whot

Works for me. Please just set export LC_ALL=C at the top of the script for now. We can explore if UTF-8 is necessary in another request since the same logic will probably also apply to sysinfo.sh.

jigpu avatar Feb 10 '21 17:02 jigpu