Is linux kernel implemented tty always render data using UTF-8?
up vote
4
down vote
favorite
It seems so. I read IUTF8, but the document only said it allows you to handle input as UTF-8 when doing line-editing.
But what about output? If you use a GUI Terminal, it usually allows you to change the encoding to render bytes in the pty's output buffer, but what about kernel-implemented tty?
Does Linux always render bytes in tty's output buffer using UTF-8?
linux tty unicode
add a comment |
up vote
4
down vote
favorite
It seems so. I read IUTF8, but the document only said it allows you to handle input as UTF-8 when doing line-editing.
But what about output? If you use a GUI Terminal, it usually allows you to change the encoding to render bytes in the pty's output buffer, but what about kernel-implemented tty?
Does Linux always render bytes in tty's output buffer using UTF-8?
linux tty unicode
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
It seems so. I read IUTF8, but the document only said it allows you to handle input as UTF-8 when doing line-editing.
But what about output? If you use a GUI Terminal, it usually allows you to change the encoding to render bytes in the pty's output buffer, but what about kernel-implemented tty?
Does Linux always render bytes in tty's output buffer using UTF-8?
linux tty unicode
It seems so. I read IUTF8, but the document only said it allows you to handle input as UTF-8 when doing line-editing.
But what about output? If you use a GUI Terminal, it usually allows you to change the encoding to render bytes in the pty's output buffer, but what about kernel-implemented tty?
Does Linux always render bytes in tty's output buffer using UTF-8?
linux tty unicode
linux tty unicode
asked 2 days ago
神秘德里克
369112
369112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
"Linux" as such, does not do this. Applications (including, but not limited to, terminal emulators) do that—or do not.
The Linux console terminal is a terminal emulator which may/may not interpret UTF-8. See the console_codes(4)
manual page for more information. That should list the controls for switching the output character set, e.g.,
ESC % Start sequence selecting character set
ESC % @ Select default (ISO 646 / ISO 8859-1)
ESC % G Select UTF-8
ESC % 8 Select UTF-8 (obsolete)
but seeing that the final comment on the page corresponds to this change in 2006, suspect that the conversion to web format lost some text. Another site gives a more complete representation (though that site also has issues as mentioned here).
If you really want to read the manual page, your local computer likely does a better job than either...
You can turn UTF-8 mode off/on, using the sequences ending in @
or G
, respectively. I use this script occasionally to do that:
#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '33%%@'
else
printf '33%%G'
fi
(and having commented on that before, someone reminds that there is a script to do this, which is a little older than my script).
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
|
show 2 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487497%2fis-linux-kernel-implemented-tty-always-render-data-using-utf-8%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
"Linux" as such, does not do this. Applications (including, but not limited to, terminal emulators) do that—or do not.
The Linux console terminal is a terminal emulator which may/may not interpret UTF-8. See the console_codes(4)
manual page for more information. That should list the controls for switching the output character set, e.g.,
ESC % Start sequence selecting character set
ESC % @ Select default (ISO 646 / ISO 8859-1)
ESC % G Select UTF-8
ESC % 8 Select UTF-8 (obsolete)
but seeing that the final comment on the page corresponds to this change in 2006, suspect that the conversion to web format lost some text. Another site gives a more complete representation (though that site also has issues as mentioned here).
If you really want to read the manual page, your local computer likely does a better job than either...
You can turn UTF-8 mode off/on, using the sequences ending in @
or G
, respectively. I use this script occasionally to do that:
#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '33%%@'
else
printf '33%%G'
fi
(and having commented on that before, someone reminds that there is a script to do this, which is a little older than my script).
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
|
show 2 more comments
up vote
2
down vote
accepted
"Linux" as such, does not do this. Applications (including, but not limited to, terminal emulators) do that—or do not.
The Linux console terminal is a terminal emulator which may/may not interpret UTF-8. See the console_codes(4)
manual page for more information. That should list the controls for switching the output character set, e.g.,
ESC % Start sequence selecting character set
ESC % @ Select default (ISO 646 / ISO 8859-1)
ESC % G Select UTF-8
ESC % 8 Select UTF-8 (obsolete)
but seeing that the final comment on the page corresponds to this change in 2006, suspect that the conversion to web format lost some text. Another site gives a more complete representation (though that site also has issues as mentioned here).
If you really want to read the manual page, your local computer likely does a better job than either...
You can turn UTF-8 mode off/on, using the sequences ending in @
or G
, respectively. I use this script occasionally to do that:
#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '33%%@'
else
printf '33%%G'
fi
(and having commented on that before, someone reminds that there is a script to do this, which is a little older than my script).
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
|
show 2 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
"Linux" as such, does not do this. Applications (including, but not limited to, terminal emulators) do that—or do not.
The Linux console terminal is a terminal emulator which may/may not interpret UTF-8. See the console_codes(4)
manual page for more information. That should list the controls for switching the output character set, e.g.,
ESC % Start sequence selecting character set
ESC % @ Select default (ISO 646 / ISO 8859-1)
ESC % G Select UTF-8
ESC % 8 Select UTF-8 (obsolete)
but seeing that the final comment on the page corresponds to this change in 2006, suspect that the conversion to web format lost some text. Another site gives a more complete representation (though that site also has issues as mentioned here).
If you really want to read the manual page, your local computer likely does a better job than either...
You can turn UTF-8 mode off/on, using the sequences ending in @
or G
, respectively. I use this script occasionally to do that:
#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '33%%@'
else
printf '33%%G'
fi
(and having commented on that before, someone reminds that there is a script to do this, which is a little older than my script).
"Linux" as such, does not do this. Applications (including, but not limited to, terminal emulators) do that—or do not.
The Linux console terminal is a terminal emulator which may/may not interpret UTF-8. See the console_codes(4)
manual page for more information. That should list the controls for switching the output character set, e.g.,
ESC % Start sequence selecting character set
ESC % @ Select default (ISO 646 / ISO 8859-1)
ESC % G Select UTF-8
ESC % 8 Select UTF-8 (obsolete)
but seeing that the final comment on the page corresponds to this change in 2006, suspect that the conversion to web format lost some text. Another site gives a more complete representation (though that site also has issues as mentioned here).
If you really want to read the manual page, your local computer likely does a better job than either...
You can turn UTF-8 mode off/on, using the sequences ending in @
or G
, respectively. I use this script occasionally to do that:
#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '33%%@'
else
printf '33%%G'
fi
(and having commented on that before, someone reminds that there is a script to do this, which is a little older than my script).
edited yesterday
answered yesterday
Thomas Dickey
51.9k594164
51.9k594164
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
|
show 2 more comments
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
I don't have time to check right now, but suspect that the text missing from the (very old) webpage was part of changes I made ~2006. Will investigate, tonight.
– Thomas Dickey
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
man7.org/linux/man-pages/man4/console_codes.4.html git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man4/…
– JdeBP
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
Hmm what happen when you issue init=/bin/bash, who is controlling all this?
– Luciano Andress Martini
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
but the linux console terminal is implemented in kernel, so "Linux" the kernel does this (it interprets utf-8). The kernel named "Linux" is the "application" and the "terminal emulator" in this case.
– mosvy
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
It does this when it's told to, not otherwise. If you reset the terminal, it goes back to ISO-8859-1, as noted in bug reports.
– Thomas Dickey
yesterday
|
show 2 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487497%2fis-linux-kernel-implemented-tty-always-render-data-using-utf-8%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown