LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Reading Hindi language document from terminal (http://www.linuxquestions.org/questions/linux-newbie-8/reading-hindi-language-document-from-terminal-867193/)

ntu929 03-08-2011 07:04 AM

Reading Hindi language document from terminal
 
Hi all,

i having Ubuntu 10.04 Lucid Lynx at Dell laptop. i want to read documents written in hindi language. i have a font called Mangla installed in open-office that helps to read these files. But if i open them in gedit or display them by using following command, i cannot open them in readable format:-

cat Hindi.txt

output is as follows:-

##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�## ##�##�##�##�###################(##*##.##0##8##:##D##F##N##P##T##V##\##^##f##h##p##r##~##� ##�###������������������������������ ��������������������������������� ���������������������������##hi�#hi�OJ#QJ# ^J###hi�#hi�OJ#QJ#^J#[#�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�##�#####
##########6##8##<##>##H##J##R##T##X##Z##`##b##l##n##v##x##�##�###�##�##�##�##�##�## ##�##�##�##�##�##�##�##�##�##�##�##�################ ##(##*##2##8##F##H##V##Z##h##j##r##t##x##z##�###�##�##�##�##�##�##�##�##�##� ��������������������������������� ��������������������������������� ����������������������##hi�#hi�OJ#QJ#^J###hi�#hi �OJ#QJ#^J#[###�##8###R##�##�##�!# %#�%'##(#�(#�)##+#�+#�,#&.#�.##v0#�1#l2#Z3#�4##6##7#.8#\9#�������� ��������������������##gd#W�#�##�##

i want this file should also be readable to a executable file of (CMU's toolkit).

i have installed several types of fonts such as lohit_hi.ttf.
the system does seem to be recognizing this language.


Please tell how to solve this problem. :( ...its urgent

TB0ne 03-08-2011 08:27 AM

Quote:

Originally Posted by ntu929 (Post 4282669)
Hi all,
i having Ubuntu 10.04 Lucid Lynx at Dell laptop. i want to read documents written in hindi language. i have a font called Mangla installed in open-office that helps to read these files. But if i open them in gedit or display them by using following command, i cannot open them in readable format:-

cat Hindi.txt output is as follows:-

i want this file should also be readable to a executable file of (CMU's toolkit).

i have installed several types of fonts such as lohit_hi.ttf. the system does seem to be recognizing this language.
Please tell how to solve this problem. :( ...its urgent

No, this is NOT urgent for anyone here. We volunteer our time, and answer when we want to.

You don't say what terminal program you're using, but you can specify which font to use in most of them. In Gedit, go into the preferences menu, and set the font there. If you're using the Hindi language as your desktop default, this should automatically happen...are you? If not, you will then have to specify which font(s) to use when you fire up a terminal or Gedit.

ntu929 03-09-2011 04:28 AM

Re: Reading Hindi language document from terminal
 
Quote:

Originally Posted by TB0ne (Post 4282751)
No, this is NOT urgent for anyone here. We volunteer our time, and answer when we want to.

i understand that i was strong in words (to say URGENT). Indeed people @ linuxquestions.org do things out of their love for linux os and not bound to reply to threads in any time bound manner....


Quote:

Originally Posted by TB0ne (Post 4282751)
You don't say what terminal program you're using, but you can specify which font to use in most of them.

The terminal program is from CMU university. It is called
Statistical Language Modeling Toolkit. Its specific executable is text2wfreq. This executable's help gives output as :-

text2wfreq : Generate a word frequency list for text.
Usage : text2freq [ -hash 1000000 ]
[ -verbosity 2 ]
< .text > .wfreq


After giving input as Hindi.text, the word freq file is not displayed properly. head command returns words which are not legible....

Quote:

Originally Posted by TB0ne (Post 4282751)

In Gedit, go into the preferences menu, and set the font there. If you're using the Hindi language as your desktop default, this should automatically happen...are you? If not, you will then have to specify which font(s) to use when you fire up a terminal or Gedit.

Hindi language is not present in gedits preference menus.

Also by changing the default language can it make any difference in the display at terminal ?

Can any type of fonts compliant with (UTF, UTF-8,UTF-16) be used ?

Does it make any difference ?

TB0ne 03-09-2011 09:48 AM

Quote:

Originally Posted by ntu929 (Post 4283935)
The terminal program is from CMU university. It is called
Statistical Language Modeling Toolkit. Its specific executable is text2wfreq. This executable's help gives output as :-

text2wfreq : Generate a word frequency list for text.
Usage : text2freq [ -hash 1000000 ]
[ -verbosity 2 ]
< .text > .wfreq

After giving input as Hindi.text, the word freq file is not displayed properly. head command returns words which are not legible....

As I said before, if you select that language for your desktop environment, it'll be used (along with the fonts), in other apps. If you're running a terminal session, how you specify the font to use depends on the terminal program. Putty is different from xterm, which is different from konsole, etc. What the specific program you're using requires is another matter. Read the man page and/or the documentation to find out what language support that program has.
Quote:

Hindi language is not present in gedits preference menus.
No, it wouldn't be...just the FONT would be, which would then allow the correct character set to be displayed. Again, change your desktop language environment to be Hindi, and other program will use the correct character sets accordingly.
Quote:

Also by changing the default language can it make any difference in the display at terminal ? Can any type of fonts compliant with (UTF, UTF-8,UTF-16) be used ? Does it make any difference ?
Yes, still....changing the default language changes the character set(s) used by the programs.

ntu929 03-14-2011 03:39 AM

Re: Reading Hindi language document from terminal
 
Quote:

Originally Posted by TB0ne (Post 4284321)
As I said before, if you select that language for your desktop environment, it'll be used (along with the fonts), in other apps. If you're running a terminal session, how you specify the font to use depends on the terminal program. Putty is different from xterm, which is different from konsole, etc. What the specific program you're using requires is another matter. Read the man page and/or the documentation to find out what language support that program has.

No, it wouldn't be...just the FONT would be, which would then allow the correct character set to be displayed. Again, change your desktop language environment to be Hindi, and other program will use the correct character sets accordingly.

Yes, still....changing the default language changes the character set(s) used by the programs.

Now you had said that in order to view this document, we require specifying font for this program (cat) and others which may be specific to the individual programs.

So Please tell how to go about specifying right font for this appilcation (cat).
*
As indicated earlier I have changed the default language to Hindi. But the problem still persists. If i want to read this Hindi file.
I had copied the date and day from system menu item and saved it in a file. When i view it using cat and gedit it gets opned but this paticular file is not being opened.

What should be done ?

TB0ne 03-14-2011 09:51 AM

Quote:

Originally Posted by ntu929 (Post 4290001)
Now you had said that in order to view this document, we require specifying font for this program (cat) and others which may be specific to the individual programs.

So Please tell how to go about specifying right font for this appilcation (cat).

No, I did NOT say that. What I told you was that each TERMINAL program had/has a different way of specifying which font to use when you invoke it. The cat command will inherit the font set/language set from the system.
Quote:

As indicated earlier I have changed the default language to Hindi. But the problem still persists. If i want to read this Hindi file. I had copied the date and day from system menu item and saved it in a file. When i view it using cat and gedit it gets opned but this paticular file is not being opened.
What should be done ?
Then you either haven't changed the system language correctly, or the file isn't in the Hindi character set. Since you say you can open another file with Hindi information, but not THIS one, then signs point to that file being corrupted/incorrect.

davholla 03-14-2011 10:16 AM

What happens if you open the file but not from the terminal? Can you open it then?
If no applications can open it and you can open other files then as TB0ne says it is probably corrupted.

ntu929 03-14-2011 10:58 PM

Quote:

Originally Posted by TB0ne (Post 4290267)
No, I did NOT say that. What I told you was that each TERMINAL program had/has a different way of specifying which font to use when you invoke it. The cat command will inherit the font set/language set from the system.

Then you either haven't changed the system language correctly, or the file isn't in the Hindi character set. Since you say you can open another file with Hindi information, but not THIS one, then signs point to that file being corrupted/incorrect.

yes.... i did not restart the system so there was this problem. now the terminal program (cat) is displaying the contents of this file. But the problem is that there is lack of CLARITY of words. when i use gedit to open the file, the display is more clear. the file is being opened in open-office as i had said earlier, so i dont think it is corrupt...

Any suggestions on howto improve the clarity from terminal ?


Another thing i am developing an application to display this file in java's Japplet. it is possible to display this file in a textarea ?

TB0ne 03-15-2011 09:42 AM

Quote:

Originally Posted by ntu929 (Post 4291032)
yes.... i did not restart the system so there was this problem. now the terminal program (cat) is displaying the contents of this file. But the problem is that there is lack of CLARITY of words. when i use gedit to open the file, the display is more clear. the file is being opened in open-office as i had said earlier, so i dont think it is corrupt...
Any suggestions on howto improve the clarity from terminal ?

Again, you STILL don't say what 'terminal' you're using, so no, we don't have any suggestions, since you don't provide details. The only thing that could make a difference, is the font...so get another Hindi font that looks better to you.
Quote:

Another thing i am developing an application to display this file in java's Japplet. it is possible to display this file in a textarea ?
Well, since it's TEXT, and you're using a TEXTAREA, then obviously you can.

ntu929 03-16-2011 12:28 AM

Re: Reading Hindi language document from terminal
 
Quote:

Originally Posted by TB0ne (Post 4291522)

Again, you STILL don't say what 'terminal' you're using, so no, we don't have any suggestions, since you don't provide details. The only thing that could make a difference, is the font...so get another Hindi font that looks better to you.



i am sorry for not divulging the details...

The terminal program is the command prompt which comes with every Linux distribution. the shell is bash scripting.

Quote:

Originally Posted by TB0ne (Post 4291522)

Well, since it's TEXT, and you're using a TEXTAREA, then obviously you can.

i think following issues will be of concern (regarding developing application to view this document):-

-The display in the application will require appropriate font to be installed.

-Also another thing is accessing the file system from local hard disk.

So how to go about developing application...

TheIndependentAquarius 03-16-2011 12:52 AM

Quote:

Originally Posted by ntu929 (Post 4292189)
The terminal program is the command prompt which comes with every Linux distribution.

Many terminals come by default with many distributions, you need to be specific, if you don't know the name, tell us whether you are using Kde or Gnome or anything else? People may try to guess by that.

Xterm
Konsole
Gnome terminal
LXterminal
...

Quote:

Originally Posted by ntu929 (Post 4283935)
The terminal program is from CMU university. It is called
Statistical Language Modeling Toolkit. Its specific executable is text2wfreq.

Are you not using the default Linux terminal or I am barking up the wrong tree?

ntu929 03-16-2011 01:17 AM

Quote:

Originally Posted by Anisha Kaul (Post 4292197)
Many terminals come by default with many distributions, you need to be specific, if you don't know the name, tell us whether you are using Kde or Gnome or anything else? People may try to guess by that.

Xterm
Konsole
Gnome terminal
LXterminal
...


Are you not using the default Linux terminal or I am barking up the wrong tree?

Sorry once again but let me admit that i did not know the name of this terminal program and the desktop is gnome environment..

yes i am using default linux terminal. i sorry for not providing the correct info. But i need to display this using default linux terminal.

the program of text2wfreq from CMU univ runs on this default terminal program. This program (text2wfreq) now accepts this document( written in hindi).

As told by TBONE, i was installed hindi as the default language and now some display of the hindi document is there but there is lack of clarity. my ubuntu version is 10.04. Can you suggest some good font (as told by TBONE) i have tried some free fonts such as JanakHindi font from CDAC, Mangla font.

Once again sorry for lack of proper communication...

Regards,
ntu929

TheIndependentAquarius 03-16-2011 01:29 AM

Now I realize, you mentioned Ubuntu in your OP and Ubuntu by default uses Gnome and Gnome by default uses "Gnome terminal" which can also be started by the command gnome-terminal.

Hit out Google with the keywords:
Devanagari fonts

and then with the keywords:
installing Windows fonts in Linux

vikasmailsu 02-05-2013 05:34 AM

Request
 
Hi

I am facing the similar problem too.

I am using RedHat Enterprise Linux 4 ediiton.

I would like to open a file which contain hindi string ,
I make changes in the bashrc and bash_profile to set

export LANG=hi_IN.UTF-8

and restart the system, then I try to open the said file in Linux using cat command

It working fine.

But when I run the user created application(c++ program) that generate Hindi messages on terminal as well as create a hindi file . The hindi file is genearted successfully, but hindi messages are not coming in terminal.
So I used setLocale function inside my c++ application, it resolved the problem. But I would like to know
Is there any other way by which I can display Hindi message on terminal with my user created c++ application without using any setlocale function.

I notice one more thing I can display hindi file without setting
export LANG=hi_IN.UTF-8
in bashrc and bash_profile where my current language is English .

Thanks & Regards
Vikas

shivaa 02-05-2013 08:39 PM

@vikasmailsu:
Please continue with your new post (here). You can update the same in new post.

However, 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...?


All times are GMT -5. The time now is 01:13 AM.