summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vconsole/vconsole-setup.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index d04fab44e3..aa5fa18525 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -80,6 +80,25 @@ static int disable_utf8(int fd) {
return r;
}
+static int enable_utf8(int fd) {
+ int r = 0, k;
+
+ if (ioctl(fd, KDSKBMODE, K_UNICODE) < 0)
+ r = -errno;
+
+ if (loop_write(fd, "\033%G", 3, false) < 0)
+ r = -errno;
+
+ k = write_one_line_file("/sys/module/vt/parameters/default_utf8", "1");
+ if (k < 0)
+ r = k;
+
+ if (r < 0)
+ log_warning("Failed to enable UTF-8: %s", strerror(-r));
+
+ return r;
+}
+
static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
const char *args[8];
int i = 0;
@@ -418,9 +437,12 @@ int main(int argc, char **argv) {
r = EXIT_FAILURE;
- if (!utf8)
+ if (utf8)
+ enable_utf8(fd);
+ else
disable_utf8(fd);
+
if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
load_font(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
r = EXIT_SUCCESS;