perl: warning: Setting locale failed.

on my leap 15.2 with kde running this:

exiftool -s -s  -ImageWidth "/dati/a-FOTO-x-amici/2007/2007-05-01mag(milano-como-stresa)/2007-05(milano-como-stresa)(mik)066(stresa).jpg"

I receive this error:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US",
        LC_ALL = (unset),
        LC_MEASUREMENT = "it_IT.UTF-8",
        LC_MONETARY = "it_IT.UTF-8",
        LC_COLLATE = "it_IT.UTF-8",
        LC_TIME = "en_SE.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
ImageWidth: 1200
pla@pla4-TW:~/bin/foto-comments> ^C
pla@pla4-TW:~/bin/foto-comments> 

and running locale I get:

pla@pla4-TW:~> locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME=en_SE.UTF-8
LC_COLLATE=it_IT.UTF-8
LC_MONETARY=it_IT.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=it_IT.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

googling around I found that should be something related to locale, running

locale -a

en_SE.UTF-8 is not present, if this be the why, how can I get and install en_SE.UTF-8? or if it is not, how can I solve?
manythanks :slight_smile:

I assume that this is KDE.
I also assume that you, in a desperate action to get your date showing in ISO YYY-MM-DD, have set your

LC_TIME=en_SE.UTF-8

as both the error message and the settings show.

Unfortunately many applications are not happy with this Swedish-English combination. I am afraid it is the one or the other.

You could however try to call your program with another LC_TIME setting:

LC_TIME=en_EN.UTF-8 exiftool ..........

Let us hope that KDE does repair this bug as soon as possible. :’(

Hi hccv

yes you assume right, also becouse I have written it in the first row:shame:

yes you assume right again, and also my desiderata was to have YYYY-mmm-DDD with the month in letters as jan feb… but didn’t succeed

let’s hope…

manythanks hccv but it doesn’t works

pla@pla4-TW:~/bin/foto-comments> LC_TIME=en_EN.UTF-8 exiftool -s -s  -ImageWidth "/dati/a-FOTO-x-amici/2007/2007-05-01mag(milano-como-stresa)/2007-05(milano-como-stresa)(mik)066(stresa).jpg"
bash: warning: setlocale: LC_TIME: cannot change locale (en_SE.UTF-8)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US",
        LC_ALL = (unset),
        LC_TIME = "en_EN.UTF-8",
        LC_MEASUREMENT = "it_IT.UTF-8",
        LC_MONETARY = "it_IT.UTF-8",
        LC_COLLATE = "it_IT.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
ImageWidth: 1200
pla@pla4-TW:~/bin/foto-comments> 


I also googled to modify UTF8 locale but they say to edit files that in leap 15.2 aren’t editable with text editors, I found something in /usr/share/locale/en_US/ but there are only desktop files as I understand, and /usr/lib/locale/en_US.utf8/ where there are files that in the tutorials they assume to be editable like LC_TIME but they are not.
workaround1, I noted that the

LC_TIME=en_EN.UTF-8 exiftool ..........

and

exiftool ..........

gives the desired result, “ImageWidth: 1200” but with a lot of comments, as I use this command to have a list and then use this list to do other operations, could it be possible to not have the comments on errors, to have perl less verbose?
workarount2 I’ll try to set time to en_US when I have to perform perl…

Well, when changing the value of LC_TIME for the execution of the command results in the results as wanted, it proves that my idea about this was right. The application has problems with the value you use and it doesn’t with a more common value.

I do however know nothing about that application exiftool (although I can guess that it’s area of application is working on the EXIF of image files). Thus I can only point you to the “why” (as I did), but I can not tell what is the best solution in your case. You can of course switch back to a LC_TIME value more fitting to the rest of your locale, or use an alias to permanently add the value to any exiftool call, but that is all up to you, now knowing what the root cause is.

Maybe should have been LC_TIME=en_US.UTF-8 to fit better with the rest?

I use exiftool to know the picture width to use this value with magick (a very useful program to extend the picture and annotate directly on the picture using “magick extent” and “magick annotate”) to automatically extend and annotate on the picture a long list of pictures.

Hi hcvv, with LC_TIME=en_US.UTF-8 the result was the same,
…but your idea of alias triggered me that “en_SE.UTF-8” could be aliased to or copied from “en_US.UTF-8”, so I copied “usr/lib/locale/en_US.utf8” and “usr/share/locale/en_US” and renamed respectively “usr/lib/locale/en_SE.utf8” and “usr/share/locale/en_SE”, rebooted, and it works!!!

pla@pla4-TW:~/bin/foto-comments> exiftool -s -s  -ImageWidth "/dati/a-FOTO-x-amici/2007/2007-05-01mag(milano-como-stresa)/2007-05(milano-como-stresa)(mik)066(stresa).jpg"
ImageWidth: 1200

maaaanythanks hanckrotfl!
and furthermore in dolphin I have ISO date and also in the watch

Well, an alias, as I suggested, is not what you did. But as it helped you in getting a workable solution, I will not complain lol!.

BTW, your description triggered something in my brain.

I once needed HEIGHT and WIDTH of images. The solution for a JPEG:

  • search from the start of the file until the sequence x’ffc0’;
  • skip the next 3 bytes;
  • next two bytes are the HEIGHT;
  • next two bytes are the WIDTH.

I managed to program this in ksh (that is almost bash).