mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 08:46:40 +08:00
src: allow setting a default language in the CLI tool.
The syntax of --weight stays the same with the addition that the language '*' means setting the default weight. For instance, if you are sure that your input is either French or English, you could run: > uchardet -l -w 'fr:1,en:1,*:0' (setting same weight to French and English, and everything else to 0)
This commit is contained in:
parent
9699dfce07
commit
06029ec334
@ -190,6 +190,9 @@ int main(int argc, char ** argv)
|
||||
return 1;
|
||||
}
|
||||
*comma = '\0';
|
||||
if (strcmp (lang_weight, "*") == 0)
|
||||
uchardet_set_default_weight(handle, strtof (comma + 1, NULL));
|
||||
else
|
||||
uchardet_weigh_language(handle, lang_weight, strtof (comma + 1, NULL));
|
||||
}
|
||||
while ((lang_weight = strtok_r (NULL, ",", &saveptr)));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user