Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

i need help in translating the language

by uva (Sexton)
on Feb 15, 2006 at 14:36 UTC ( [id://530388]=perlquestion: print w/replies, xml ) Need Help??

uva has asked for the wisdom of the Perl Monks concerning the following question:

dear monks, i have doubt in the following code,
use Unicode::Indic::Telugu; use strict; my $lang = Unicode::Indic::Telugu->new () or print "noti "; my $text = "Sriiraama jayaraama jaya jaya raama"; my $out = $lang-> translate($text) or print "not "; print $out;
if i execute that program,it is not printing the actual language, it is printing as
Wide character in print at telu.pl line 7 Ó░ÂÓ▒ìÓ░░Ó▒ÇÓ░░Ó░¥Ó&#9 +617;« Ó░£Ó░»Ó░░Ó░¥Ó░« Ó░£Ó& +#9617;» Ó░£Ó░» Ó░░Ó░¥Ó░«ok 3
what it is printing , where is my actual words??

Replies are listed 'Best First'.
Re: i need help in translating the language
by Anonymous Monk on Feb 15, 2006 at 15:25 UTC

    You need to mark your output filehandle for unicode. Since you're printing to standard out, binmode STDOUT, ':utf8'; does the trick.

    You need to have some Indic fonts, else you just see replacement characters, for example boxes or question marks. sudo apt-get install indic-fonts

    This is what I see. screenshot on imageshack.us

    Next time on perlmonks, mind that we're an international community and as such speak standard English here. -> "Question" vs "Doubt"

Re: i need help in translating the language
by radiantmatrix (Parson) on Feb 15, 2006 at 15:32 UTC

    The output you are seeing is indicative of printing Unicode data to a terminal that doesn't support Unicode (or hasn't been told to expect it). Try printing to a file handle opened with the utf-8 encoding and then read it with a Unicode-aware editor.

    <-radiant.matrix->
    A collection of thoughts and links from the minds of geeks
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet
      how to open a file handle with the utf-8 encoding.
        perldoc -f open

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://530388]
Approved by McDarren
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2025-01-13 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (28 votes). Check out past polls.