UTF-8 unicode encoding in terminal
NOTE: I have looked through related threads but can't find the solution to my problem.
Hello. I am creating a small game where you can play a round of poker in the terminal. For this I of course want the spades, hearts, clover and diamonds symbols. Using u2660 etc I get the icons to display in my IDE, but they wont display in my terminal. I have tried the following:
locale
displays
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I have
# coding=UTF-8
in the program.
I also have
LANG=en_EN.UTF8
in my bash_profile.
I am using a Mac if that's relevant.

This is from the terminal settings.
Any help is much appreciated
bash unicode utf-8 terminal
add a comment |
NOTE: I have looked through related threads but can't find the solution to my problem.
Hello. I am creating a small game where you can play a round of poker in the terminal. For this I of course want the spades, hearts, clover and diamonds symbols. Using u2660 etc I get the icons to display in my IDE, but they wont display in my terminal. I have tried the following:
locale
displays
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I have
# coding=UTF-8
in the program.
I also have
LANG=en_EN.UTF8
in my bash_profile.
I am using a Mac if that's relevant.

This is from the terminal settings.
Any help is much appreciated
bash unicode utf-8 terminal
2
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
1
At least on my Linux systemUTF-8is not a valid locale, butC.UTF-8is. You can list all allowed locales withlocale -a.
– Socowi
Nov 24 '18 at 10:19
add a comment |
NOTE: I have looked through related threads but can't find the solution to my problem.
Hello. I am creating a small game where you can play a round of poker in the terminal. For this I of course want the spades, hearts, clover and diamonds symbols. Using u2660 etc I get the icons to display in my IDE, but they wont display in my terminal. I have tried the following:
locale
displays
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I have
# coding=UTF-8
in the program.
I also have
LANG=en_EN.UTF8
in my bash_profile.
I am using a Mac if that's relevant.

This is from the terminal settings.
Any help is much appreciated
bash unicode utf-8 terminal
NOTE: I have looked through related threads but can't find the solution to my problem.
Hello. I am creating a small game where you can play a round of poker in the terminal. For this I of course want the spades, hearts, clover and diamonds symbols. Using u2660 etc I get the icons to display in my IDE, but they wont display in my terminal. I have tried the following:
locale
displays
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I have
# coding=UTF-8
in the program.
I also have
LANG=en_EN.UTF8
in my bash_profile.
I am using a Mac if that's relevant.

This is from the terminal settings.
Any help is much appreciated
bash unicode utf-8 terminal
bash unicode utf-8 terminal
asked Nov 24 '18 at 10:01
vaultvault
174
174
2
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
1
At least on my Linux systemUTF-8is not a valid locale, butC.UTF-8is. You can list all allowed locales withlocale -a.
– Socowi
Nov 24 '18 at 10:19
add a comment |
2
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
1
At least on my Linux systemUTF-8is not a valid locale, butC.UTF-8is. You can list all allowed locales withlocale -a.
– Socowi
Nov 24 '18 at 10:19
2
2
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
1
1
At least on my Linux system
UTF-8 is not a valid locale, but C.UTF-8 is. You can list all allowed locales with locale -a.– Socowi
Nov 24 '18 at 10:19
At least on my Linux system
UTF-8 is not a valid locale, but C.UTF-8 is. You can list all allowed locales with locale -a.– Socowi
Nov 24 '18 at 10:19
add a comment |
1 Answer
1
active
oldest
votes
Your terminal needs to support Unicode (this is pretty standard these days), your locale needs to be something ending with “.UTF-8” (“UTF-8” is not valid) and your font needs to include the relevant glyph. For example, in my urxvt with LC_CTYPE="en_NZ.utf8" and the DejaVu Sans Mono the suit characters show up as expected:

add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f53457057%2futf-8-unicode-encoding-in-terminal%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
Your terminal needs to support Unicode (this is pretty standard these days), your locale needs to be something ending with “.UTF-8” (“UTF-8” is not valid) and your font needs to include the relevant glyph. For example, in my urxvt with LC_CTYPE="en_NZ.utf8" and the DejaVu Sans Mono the suit characters show up as expected:

add a comment |
Your terminal needs to support Unicode (this is pretty standard these days), your locale needs to be something ending with “.UTF-8” (“UTF-8” is not valid) and your font needs to include the relevant glyph. For example, in my urxvt with LC_CTYPE="en_NZ.utf8" and the DejaVu Sans Mono the suit characters show up as expected:

add a comment |
Your terminal needs to support Unicode (this is pretty standard these days), your locale needs to be something ending with “.UTF-8” (“UTF-8” is not valid) and your font needs to include the relevant glyph. For example, in my urxvt with LC_CTYPE="en_NZ.utf8" and the DejaVu Sans Mono the suit characters show up as expected:

Your terminal needs to support Unicode (this is pretty standard these days), your locale needs to be something ending with “.UTF-8” (“UTF-8” is not valid) and your font needs to include the relevant glyph. For example, in my urxvt with LC_CTYPE="en_NZ.utf8" and the DejaVu Sans Mono the suit characters show up as expected:

answered Nov 24 '18 at 11:54
l0b0l0b0
33.7k1584146
33.7k1584146
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53457057%2futf-8-unicode-encoding-in-terminal%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
2
Add your code to your question.
– Cyrus
Nov 24 '18 at 10:09
1
At least on my Linux system
UTF-8is not a valid locale, butC.UTF-8is. You can list all allowed locales withlocale -a.– Socowi
Nov 24 '18 at 10:19