U8LOC(1)
π NAME π
okay so listen β this is u8loc, bestie, and it's from the General Commands Manual section of your friendly neighborhood man pages. Its whole job? run a program in a UTF-8-capable environment. That's it, that's the vibe. β¨
π SYNOPSIS π
u8loc [-p] -r program [args...]
u8loc [-p] -q LC_ALL
u8loc [-p] -q LANGUAGE
u8loc -q preferred
u8loc -q list
u8loc --features
six whole shapes it can take, and yes, --features is one of them, iykyk π
π¦ DESCRIPTION π¦
So here's the tea β: u8loc sets up your environment variables so that a child process you're about to run will hopefully spit out clean UTF-8 output. Hopefully, okay, that's the manpage's word, not mine β I'm just the messenger π«Ά.
It's built for programs that want to reliably parse another program's output without worrying about character set conversions. No messy encoding drama, no mysterious mojibake. Just vibes and clean bytes. π
How does it do it? It calls the locale(1) tool to get a list of all the locale names your current system actually has valid definitions for, and then it filters and reorders that list based on either:
- a predefined list of language preferences, or
- if you pass the
-poption, the language names it finds in your current environment's locale-related variables β you know,LC_ALL,LANG,LC_MESSAGES,LC_CTYPE, etc. π
The u8loc utility accepts the following command-line options:
β¨ OPTIONS β¨
-pβ Examine the current environment's locale-related variables and use the names of languages found there as a preference list for choosing a suitable locale. Basically: "what are you already into? let's work with that." π-qβ Do not execute a program; output the detected environment settings instead, depending on the supplied argument:LC_ALLβ Output the selected UTF-8-capable locale name that would be placed into theLC_ALLenvironment variable.LANGUAGEβ Output the empty string that would be placed into theLANGUAGEenvironment variable. (Yes, empty. That's not a mistake, that's the actual answer. π)listβ List the available parameters for the-qoption.preferredβ Output the list of languages gathered from examining the locale-related environment variables.
-rβ Set theLC_ALLandLANGUAGEvariables in the environment and execute the specified program. This one actually does the thing π₯
πΈ ENVIRONMENT πΈ
If the -p option is specified, the locale-related environment variables get examined in order. And if any of them contains the name of a locale that specifies UTF-8 as its encoding β the manpage puts it as by either a βUTF-8 or βutf8 suffixββ, quote marks exactly like that, I don't make the rules π β then the language name gets added to the list of preferences.
The variables examined are, in this exact order:
LC_ALLLANGLC_MESSAGESLC_COLLATELC_NAMELC_IDENTIFICATIONLC_CTYPELC_NUMERICLC_TIMELC_MONETARYLC_PAPERLC_ADDRESSLC_TELEPHONELC_MEASUREMENT
fourteen of them, all lined up, all in order, no skipping π
π«Ά EXIT STATUS π«Ά
If an error happens while it's detecting a suitable UTF-8-capable locale, u8loc will exit with a non-zero error code. Not ideal, but at least you'll know. π
And if you specified -r, the specified program gets executed and replaces the u8loc process. So u8loc doesn't hang around afterwards β it hands over the aux cord and leaves the party. π§
π EXAMPLES π
Output the name of a UTF-8-capable locale:
u8loc -q LC_ALL
Run a program in a UTF-8-friendly environment:
u8loc -r -- cal -3
the -- is there, do not @ me, it's in the original π
β STANDARDS β
No standards documentation was harmed in the process of creating u8loc.
iconic behavior honestly. zero standards docs were traumatized in the making of this utility. π
π BUGS π
Please report any bugs in u8loc to the author. They want to know, bestie, they're not gonna be mad. π«Ά
π AUTHOR π
The u8loc utility was written by Peter Pentchev <roam@ringlet.net>.
and that's the whole page, no cap π this one ships out of Debian, dated February 1, 2021 β so go forth, set your LC_ALL, and let your child processes produce immaculate UTF-8. periodt. πβ¨π¦
π¦ where this page comes from
- debian trixie: u8loc 1.0.3-2 Β· BSD-2-Clause
- ubuntu noble: u8loc 1.0.3-1build1 Β· BSD-2-Clause
- ubuntu questing: u8loc 1.0.3-2
- ubuntu resolute: u8loc 1.0.3-2build1 Β· BSD-2-Clause
- ubuntu stonking: u8loc 1.1.2-1 Β· BSD-2-Clause
- π the page's license: BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms