U8LOC(1)

πŸ“¦
version 1.1.2 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 -p option, 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 the LC_ALL environment variable.
    • LANGUAGE β€” Output the empty string that would be placed into the LANGUAGE environment variable. (Yes, empty. That's not a mistake, that's the actual answer. πŸ’€)
    • list β€” List the available parameters for the -q option.
    • preferred β€” Output the list of languages gathered from examining the locale-related environment variables.
  • -r β€” Set the LC_ALL and LANGUAGE variables 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_ALL
  • LANG
  • LC_MESSAGES
  • LC_COLLATE
  • LC_NAME
  • LC_IDENTIFICATION
  • LC_CTYPE
  • LC_NUMERIC
  • LC_TIME
  • LC_MONETARY
  • LC_PAPER
  • LC_ADDRESS
  • LC_TELEPHONE
  • LC_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