Now I change my gnome-terminal's character encoding to "GBK" (default it is UTF-8), but how can I get the value(character encoding) in my Linux?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
The terminal uses environment variables to determine which character set to use, therefore you can determine it by looking at those variables:
or
Check encoding and language:
Get all languages:
Change to pt_PT.utf8:
If you have Python:
To my knowledge, no.
Circumstantial indications from
$LC_CTYPE
,locale
and such might seem alluring, but these are completely separated from the encoding the terminal application (actually an emulator) happens to be using when displaying characters on the screen.They only way to detect encoding for sure is to output something only present in the encoding, e.g.
ä
, take a screenshot, analyze that image and check if the output character is correct.So no, it's not possible, sadly.
locale
command with no arguments will print the values of all of the relevant environment variables except for LANGUAGE.For current encoding:
For available locales:
For available encodings: