Sounds like possibly a "Big Endian" vs. "Little Endian" processor
difference - i.e., the order things are stored in RAM (most significant
bits first vs. last).  Probably most computer systems in the world now
are the latter, since Intel is so dominant (PCs and Macs).

It might help to know what hardware you're running it on.  I'm guessing
it's a system with a Big Endian processor.

-Noel

-----Original Message-----
From: Kornel [mailto:mailingl...@pornel.net]
Sent: Wed, June 14, 2017 8:56 AM
To: lcms-user@lists.sourceforge.net
Subject: [Lcms-user] Language code backwards? ne_SU instead of en_US

I've noticed that language and country codes given by MLU functions are
backwards. When querying an ICC file containing "enUS" locale, I get
"ne" language and "SU" country.

Here's a program to reproduce:

#include <lcms2.h>
#include <stdio.h>

int main() {
    cmsHPROFILE p =
cmsOpenProfileFromFile("/Library/ColorSync/Profiles/WebSafeColors.icc",
"r"); // This profile is standard on OS X and I've verified with hexdump
that locales are in a normal byte order
    cmsMLU *mlu = cmsReadTag(p, cmsSigProfileDescriptionMLTag);

    int cnt = cmsMLUtranslationsCount(mlu);
    for(int i=0; i < cnt; i++) {
        char lang[3] = {0};
        char country[3] = {0};
        cmsMLUtranslationsCodes(mlu, i, lang, country);
        printf("%s %s\n", lang, country);
    }
}

It outputs:

ks KS
ne SU
ac SE
iv NV
tp RB
ku AU
rf UF
uh UH
hz WT
bn ON
ok RK
sc ZC
eh LI
or OR
ed ED
ti TI
vs ES
hz NC
aj PJ
le RG
tp OP
ln LN
se SE
ht HT
rt RT
if IF
rh RH
lp LP
ur UR
ra GE
ad KD
------------------------------------------------------------------------
------
Check out the vibrant tech community on one of the world's most engaging
tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to