Unable to display a file encoded in ISO-8859-9 to the terminal
In short: How can I display a file to the terminal that is not encoded in UTF-8?
Currently, I have a test file encoded in ISO-8859-9 and containing the following 12 characters:
ğüşıöçĞÜŞİÖÇ
The hex contents of the file is like this:
F0FCFEFDF6E7D0DCDEDDD6C7
When I try to display this file to the terminal, I get:
������������
I guess this is because, my current locale is defined like this:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
However, I installed the Turkish locale to the system:
$ locale -a
C
C.UTF-8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
tr_TR
tr_TR.iso88599
tr_TR.utf8
turkish
So, I want to temporarily change the display language with the following:
$ export LC_ALL=tr_TR.iso88599
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="tr_TR.iso88599"
LC_NUMERIC="tr_TR.iso88599"
LC_TIME="tr_TR.iso88599"
LC_COLLATE="tr_TR.iso88599"
LC_MONETARY="tr_TR.iso88599"
LC_MESSAGES="tr_TR.iso88599"
LC_PAPER="tr_TR.iso88599"
LC_NAME="tr_TR.iso88599"
LC_ADDRESS="tr_TR.iso88599"
LC_TELEPHONE="tr_TR.iso88599"
LC_MEASUREMENT="tr_TR.iso88599"
LC_IDENTIFICATION="tr_TR.iso88599"
LC_ALL=tr_TR.iso88599
$ cat a.txt
������������
But, I still get the question marks.
command-line locale encoding character-set iconv
add a comment |
In short: How can I display a file to the terminal that is not encoded in UTF-8?
Currently, I have a test file encoded in ISO-8859-9 and containing the following 12 characters:
ğüşıöçĞÜŞİÖÇ
The hex contents of the file is like this:
F0FCFEFDF6E7D0DCDEDDD6C7
When I try to display this file to the terminal, I get:
������������
I guess this is because, my current locale is defined like this:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
However, I installed the Turkish locale to the system:
$ locale -a
C
C.UTF-8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
tr_TR
tr_TR.iso88599
tr_TR.utf8
turkish
So, I want to temporarily change the display language with the following:
$ export LC_ALL=tr_TR.iso88599
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="tr_TR.iso88599"
LC_NUMERIC="tr_TR.iso88599"
LC_TIME="tr_TR.iso88599"
LC_COLLATE="tr_TR.iso88599"
LC_MONETARY="tr_TR.iso88599"
LC_MESSAGES="tr_TR.iso88599"
LC_PAPER="tr_TR.iso88599"
LC_NAME="tr_TR.iso88599"
LC_ADDRESS="tr_TR.iso88599"
LC_TELEPHONE="tr_TR.iso88599"
LC_MEASUREMENT="tr_TR.iso88599"
LC_IDENTIFICATION="tr_TR.iso88599"
LC_ALL=tr_TR.iso88599
$ cat a.txt
������������
But, I still get the question marks.
command-line locale encoding character-set iconv
1
I'm guessing here - but have you triediconv? e.g.iconv -f ISO-8859-9 -t utf-8//translit test-file
– steeldriver
Mar 15 at 11:09
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41
add a comment |
In short: How can I display a file to the terminal that is not encoded in UTF-8?
Currently, I have a test file encoded in ISO-8859-9 and containing the following 12 characters:
ğüşıöçĞÜŞİÖÇ
The hex contents of the file is like this:
F0FCFEFDF6E7D0DCDEDDD6C7
When I try to display this file to the terminal, I get:
������������
I guess this is because, my current locale is defined like this:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
However, I installed the Turkish locale to the system:
$ locale -a
C
C.UTF-8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
tr_TR
tr_TR.iso88599
tr_TR.utf8
turkish
So, I want to temporarily change the display language with the following:
$ export LC_ALL=tr_TR.iso88599
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="tr_TR.iso88599"
LC_NUMERIC="tr_TR.iso88599"
LC_TIME="tr_TR.iso88599"
LC_COLLATE="tr_TR.iso88599"
LC_MONETARY="tr_TR.iso88599"
LC_MESSAGES="tr_TR.iso88599"
LC_PAPER="tr_TR.iso88599"
LC_NAME="tr_TR.iso88599"
LC_ADDRESS="tr_TR.iso88599"
LC_TELEPHONE="tr_TR.iso88599"
LC_MEASUREMENT="tr_TR.iso88599"
LC_IDENTIFICATION="tr_TR.iso88599"
LC_ALL=tr_TR.iso88599
$ cat a.txt
������������
But, I still get the question marks.
command-line locale encoding character-set iconv
In short: How can I display a file to the terminal that is not encoded in UTF-8?
Currently, I have a test file encoded in ISO-8859-9 and containing the following 12 characters:
ğüşıöçĞÜŞİÖÇ
The hex contents of the file is like this:
F0FCFEFDF6E7D0DCDEDDD6C7
When I try to display this file to the terminal, I get:
������������
I guess this is because, my current locale is defined like this:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
However, I installed the Turkish locale to the system:
$ locale -a
C
C.UTF-8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
tr_TR
tr_TR.iso88599
tr_TR.utf8
turkish
So, I want to temporarily change the display language with the following:
$ export LC_ALL=tr_TR.iso88599
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="tr_TR.iso88599"
LC_NUMERIC="tr_TR.iso88599"
LC_TIME="tr_TR.iso88599"
LC_COLLATE="tr_TR.iso88599"
LC_MONETARY="tr_TR.iso88599"
LC_MESSAGES="tr_TR.iso88599"
LC_PAPER="tr_TR.iso88599"
LC_NAME="tr_TR.iso88599"
LC_ADDRESS="tr_TR.iso88599"
LC_TELEPHONE="tr_TR.iso88599"
LC_MEASUREMENT="tr_TR.iso88599"
LC_IDENTIFICATION="tr_TR.iso88599"
LC_ALL=tr_TR.iso88599
$ cat a.txt
������������
But, I still get the question marks.
command-line locale encoding character-set iconv
command-line locale encoding character-set iconv
edited Mar 15 at 16:13
FedonKadifeli
asked Mar 15 at 11:02
FedonKadifeliFedonKadifeli
86
86
1
I'm guessing here - but have you triediconv? e.g.iconv -f ISO-8859-9 -t utf-8//translit test-file
– steeldriver
Mar 15 at 11:09
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41
add a comment |
1
I'm guessing here - but have you triediconv? e.g.iconv -f ISO-8859-9 -t utf-8//translit test-file
– steeldriver
Mar 15 at 11:09
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41
1
1
I'm guessing here - but have you tried
iconv? e.g. iconv -f ISO-8859-9 -t utf-8//translit test-file– steeldriver
Mar 15 at 11:09
I'm guessing here - but have you tried
iconv? e.g. iconv -f ISO-8859-9 -t utf-8//translit test-file– steeldriver
Mar 15 at 11:09
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41
add a comment |
1 Answer
1
active
oldest
votes
You can use the iconv utility (note: it does not convert the file in-place; the converted output is displayed in the terminal unless you redirect it elsewhere).
Ex.
$ file file.ISO-8859-9
file.ISO-8859-9: ISO-8859 text
$ cat file.ISO-8859-9
������������
$ iconv -f ISO-8859-9 -t utf-8//translit file.ISO-8859-9
ğüşıöçĞÜŞİÖÇ
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something liketr_TR.iso88599seems be wrong.
– FedonKadifeli
Mar 15 at 16:09
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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%2faskubuntu.com%2fquestions%2f1125886%2funable-to-display-a-file-encoded-in-iso-8859-9-to-the-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
You can use the iconv utility (note: it does not convert the file in-place; the converted output is displayed in the terminal unless you redirect it elsewhere).
Ex.
$ file file.ISO-8859-9
file.ISO-8859-9: ISO-8859 text
$ cat file.ISO-8859-9
������������
$ iconv -f ISO-8859-9 -t utf-8//translit file.ISO-8859-9
ğüşıöçĞÜŞİÖÇ
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something liketr_TR.iso88599seems be wrong.
– FedonKadifeli
Mar 15 at 16:09
add a comment |
You can use the iconv utility (note: it does not convert the file in-place; the converted output is displayed in the terminal unless you redirect it elsewhere).
Ex.
$ file file.ISO-8859-9
file.ISO-8859-9: ISO-8859 text
$ cat file.ISO-8859-9
������������
$ iconv -f ISO-8859-9 -t utf-8//translit file.ISO-8859-9
ğüşıöçĞÜŞİÖÇ
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something liketr_TR.iso88599seems be wrong.
– FedonKadifeli
Mar 15 at 16:09
add a comment |
You can use the iconv utility (note: it does not convert the file in-place; the converted output is displayed in the terminal unless you redirect it elsewhere).
Ex.
$ file file.ISO-8859-9
file.ISO-8859-9: ISO-8859 text
$ cat file.ISO-8859-9
������������
$ iconv -f ISO-8859-9 -t utf-8//translit file.ISO-8859-9
ğüşıöçĞÜŞİÖÇ
You can use the iconv utility (note: it does not convert the file in-place; the converted output is displayed in the terminal unless you redirect it elsewhere).
Ex.
$ file file.ISO-8859-9
file.ISO-8859-9: ISO-8859 text
$ cat file.ISO-8859-9
������������
$ iconv -f ISO-8859-9 -t utf-8//translit file.ISO-8859-9
ğüşıöçĞÜŞİÖÇ
answered Mar 15 at 15:53
steeldriversteeldriver
70k11114186
70k11114186
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something liketr_TR.iso88599seems be wrong.
– FedonKadifeli
Mar 15 at 16:09
add a comment |
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something liketr_TR.iso88599seems be wrong.
– FedonKadifeli
Mar 15 at 16:09
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something like
tr_TR.iso88599 seems be wrong.– FedonKadifeli
Mar 15 at 16:09
Thank you very much for the detailed explanation. I may need to create a short script or command alias to easily access the iconv command as you suggested. My initial thought of just changing the locale to something like
tr_TR.iso88599 seems be wrong.– FedonKadifeli
Mar 15 at 16:09
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1125886%2funable-to-display-a-file-encoded-in-iso-8859-9-to-the-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
1
I'm guessing here - but have you tried
iconv? e.g.iconv -f ISO-8859-9 -t utf-8//translit test-file– steeldriver
Mar 15 at 11:09
No. I do not want to convert the output. I just want it to be displayed in correct format. The only solution I found out so far is to change the Terminal's character Encoding to "Turkish - ISO-8859-9" (under Compatibility). Changing the locale seems to have no effect.
– FedonKadifeli
Mar 15 at 15:41