LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 02-05-2013, 01:01 AM   #1
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Rep: Reputation: 0
displaying hindi in linux command prompt (terminal)


Hi Experts

I want to display "hindi" string on command terminal of Linux, I used

setlocale(LC_ALL, "hi_IN.utf8");

By using it I am able to display the hindi string.

Can I display Hindi without using any setLocale function in Linux's Command terninal in Linux?

Thanks & Regards
Vikas
 
Old 02-05-2013, 07:42 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Using setlocale you're changing locale settings. Instead you can first download/install any hindi fonts and then use the same in terminal.

Or you can simply download (see here) and copy/paste the desired font in fonts folder i.e. /usr/share/.../truetype/.

But what's need of using hindi font in terminal? Do you want to use hindi in a terminal while typing commands? Or just want to set titles and menus of terminal in hindi?

Last edited by shivaa; 02-05-2013 at 07:44 PM.
 
Old 02-05-2013, 08:41 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
@vikasmailsu: Repeating as mentioned here.

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...?
 
Old 02-06-2013, 02:15 AM   #4
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
I can't see any hindi font in my terminal->set character encoding->add or remove terminal encodings

Please help me.

I would like to display hindi messages in terminal using my application (where a c++ program that display hindi messages)

when I ran the said application it display ??? for each character

But when I use setlocale it display them corectly.

As mentioned by Mr Shiva, setlocale change the locale setting. I would like to display hindi messages without using setLocale funciton.

Please help me.

Thanks & Regards
Vikas
 
Old 02-06-2013, 02:31 AM   #5
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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.
 
Old 02-06-2013, 03:41 AM   #6
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

I am using Window 7 machine where I had vmware session installed with Red hat enterprise 4 edition.
I am accessing the linux terminal from this linux session itself...

I am posting my query in this forum from window 7 main machine.


Thanks & Regards
Vikas

Last edited by vikasmailsu; 02-06-2013 at 04:53 AM.
 
Old 02-06-2013, 05:00 AM   #7
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
Then lets continue from the previous answer,
Code:
cd /usr/share/fonts/
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?
 
Old 02-06-2013, 05:45 AM   #8
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

I can see the folder as follows:-
/usr/share/fonts/hi
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
Vikas

Last edited by vikasmailsu; 02-06-2013 at 05:47 AM.
 
Old 02-07-2013, 06:37 AM   #9
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

Can anybody help me, I am stuck in this problem from last few days and I don't know how I can proceed further.

Please help me if anybody know the process or steps to follow to solve the said problem.

It's a request to all the experts or member of this forum.

Thanks & Regards
Vikas
 
Old 02-07-2013, 02:12 PM   #10
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
If I didn't get you wrong ANDDD you have your font setup correctly. Go edit your .bashrc file. Usually at ~/home/.bashrc:
make sure the following line is there or changed to:
Code:
export LANG=hi_IN.UTF-8
reboooooot and I believe you should start seeing hindi in your terminal.
Ted
 
Old 02-07-2013, 09:35 PM   #11
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

Thanks for responding me. I already tried the said thing i.e

export LANG=hi_IN.UTF-8

in both bashrc and bash_profile in my linux session


But I can't see any hindi messages when I ran my application, but my whole session get changed to HIndi version. I mean GUI etc.

One thing I notice as mentioned by Mr. Shivaa,
"
(Open a terminal > Open Terminal tab > Set Character Encoding > Add or Remove)?"

I can't see any character encoding for Hindi in my terminal.
see below the link, I posted in some old post too my problem:-
http://www.linuxquestions.org/questi...3/#post4282669

Thanks & Regards
Vikas

Last edited by vikasmailsu; 02-07-2013 at 10:24 PM.
 
Old 02-07-2013, 11:22 PM   #12
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
@vikasmailsu:
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-07-2013 at 11:42 PM. Reason: Info. added
 
Old 02-07-2013, 11:50 PM   #13
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

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
setlocale(LC_ALL, "hi_IN.utf8")

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:-

export LANG=hi_IN.UTF-8

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.

Please tell me if there is any confusion.

Thanks & Regards
Vikas
 
Old 02-08-2013, 01:54 AM   #14
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

Please help me if anybody know the solution for Red hat Enterprise editon 4.

Thanks & Regards
Vikas

Last edited by vikasmailsu; 02-08-2013 at 04:54 AM.
 
Old 02-10-2013, 04:08 AM   #15
vikasmailsu
LQ Newbie
 
Registered: Mar 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hi Experts

Is it not possible to display Hindi in Linux terminal in red hat enterprise ediiton 4?

Thanks & Regards
Vikas
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Hindi language document from terminal ntu929 Linux - Newbie 14 02-05-2013 08:39 PM
[SOLVED] command prompt missing in terminal ibwood Linux - Newbie 13 07-15-2010 02:45 PM
terminal (command prompt) in geexbox schneidz Linux - Distributions 1 06-23-2009 02:09 PM
Coloured command prompt everytime I open the terminal? sd9 Linux - Newbie 1 06-05-2009 12:46 AM
Terminal/command prompt has insane refresh rate, looking how to change it. Wolvenmoon Linux - Newbie 2 06-01-2006 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration