displaying hindi in linux command prompt (terminal)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Did you check whether character encoding for hindi is available in your terminal/desktop environment (Open a terminal > Open Terminal tab > Set Character Encoding > Add or Remove)?
Also what type of font's you've installed - .ttf/.otf or Postscript...?
First, we need to know if you are accessing the linux machine from another computer (putty? telnet?) or just the terminal on the linux machine itself. Because you seem to be posting from a win 7? if I am not wrong.
Check the child directories if there are any hindi fonts? From my experience is that you should set the charset of your terminal to UTF8.
Are you seeing hindi from other programs? eg firefox, text editor?
I can see the folder as follows:-
it contain the file named fonts.cache-1 and lohit_hi.ttf
If I am not wrong , these are hindi font file too.
you can see in the terminal:-Edit->current profile->
Uncheck the system terminal font, then font button get enabled and then when you click on the font button, you can see the list of hindi as well as other font too.
As you said
"From my experience is that you should set the charset of your terminal to UTF8"
What do you mean by this?
No I am not seeing hindi from other programs? eg firefox, text editor too. I checked with text editor, and I am not able to display hindi file in text editor. But if I open the same file using cat comand , I can see the contents in the terminal
But when I use my application , that display hindi messages ; it display ??? for each hindi chracter.
If I used setlocale with hindi in my c++ programe, then if I ran the application. I can see hindi messages in the terminal too.
I would like to display Hindi messages without using setlocale function, because setlocale just change the locale setting.
Please help me .
Thanks & Regards
Last edited by vikasmailsu; 02-06-2013 at 06:47 AM.
I had asked you about type (format) of hindi fonts i.e. lohit_hi.ttf in this post.
However, in a terminal, if you will check in list of available fonts (Open a terminal > Open Edit > Select Current profile > click on Font option), you will see only Monospace type of fonts. You will not even see English or other languages fonts, which are not monospace type.
Terminals use and recognize monospace fonts only or fonts originally hinted as monospace. See here for more about monospace type font.
So, problem is not with locale or character encoding of terminal, but with type of font. lohit_hi.ttf is not a monospace font, and thus your terminal cannot recognize it, whatsoever you try.
A workaround would be to download and install a monospace type of hindi font. Apparently it will be a tough task to find a monospace type of font that is developed and hinted in devanagari script i.e. in hindi. But you should try to search it.
Note: There will a limitation! A terminal is not that smart, so it can recognize two different fonts at same time. So using hindi monospace type font in a terminal might garbled all other characters which are not in hindi.
Hope this will help!
----- ADDITIONAL INFO --------
I found a solution to convert lohin_hi.ttf font into monospace font. Try Fontforge.
And then install the new monospace type font in /usr/share/fonts (or whatever location is) and try to check it in fonts list in a terminal again.
Last edited by shivaa; 02-08-2013 at 12:42 AM.
Reason: Info. added
Thanks for responding me.
I am able to see hindi messages displayed on my terminal by using setlocale.
I would like to tell you my problem again:-
I had written a c++ program, by using that application I want to display Hindi messages on Linux terminal. When I use the function
In the main function at the very beginning of my programe.When I complie and run the appication on terminal, I am able to see the hindi messages displayed on terminal.
But as meniotned by Mr Shiva, it will change the locale settings . I would like to give the user the flexibility to change the locale according to their need, i.e application(program) won't force to change the locale, its control by user only.
If I am able to see HIndi messages on command terminal by setting setlocale(LC_ALL, "hi_IN.utf8"), then it mean font provided by Linux support hindi message display in the terminal.
Am I right or not?
If yes then by adding the
line as follows:-
in the files bashrc and bash_profile, I am able to change my whole linux session in to Hindi.
But the time I try to run my application from terminal, I am not able to see Hindi messages instead see ?? for each character.