Click here to get back home

Print Spanish characters in Perl?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Print Spanish characters in Perl? DanB 06-20-2008
Posted by DanB on June 20, 2008, 12:03 am
Please log in for more thread options
This is probably has a simple answer, but it isn't in my Perl books and I
have been trying to google it up using a dialup line locked down by the
telephone company to 20k bps. (And they don't offer what they call
broadband. i.e 56k)

Anyway, after a couple of hours of surfing through a very small part of
about 5 zillion hits for "Perl Unicode Spanish" at the rate of about one
page per minute, I decided to cheat and just ask.

Using Debian etch.
I am trying to build a set of Spanish flash cards using TK, and I need to
be able to display the accented characters. I know that I need to specify
them in some unicode besides utf-8, but an example of the actual Perl code
to activate(?) and use the proper unicode table is what I can't find.
Actually, Unicode is such a big topic that as a Perl beginner I might not
recognise the answer if I managed to google it up.

Anybody?

Thanks
Dan

Posted by smallpond on June 20, 2008, 9:11 am
Please log in for more thread options
DanB wrote:
> This is probably has a simple answer, but it isn't in my Perl books and I
> have been trying to google it up using a dialup line locked down by the
> telephone company to 20k bps. (And they don't offer what they call
> broadband. i.e 56k)
>
> Anyway, after a couple of hours of surfing through a very small part of
> about 5 zillion hits for "Perl Unicode Spanish" at the rate of about one
> page per minute, I decided to cheat and just ask.
>
> Using Debian etch.
> I am trying to build a set of Spanish flash cards using TK, and I need to
> be able to display the accented characters. I know that I need to specify
> them in some unicode besides utf-8, but an example of the actual Perl code
> to activate(?) and use the proper unicode table is what I can't find.
> Actually, Unicode is such a big topic that as a Perl beginner I might not
> recognise the answer if I managed to google it up.
>
> Anybody?
>
> Thanks
> Dan


Not sure if usenet will like the accented chars, but this works on the
command line:

perl -e 'use Tk; new MainWindow(-title=>"Cómo está?"); MainLoop'

** Posted from http://www.teranews.com **

Posted by Ted Zlatanov on June 20, 2008, 1:52 pm
Please log in for more thread options

JE> Oh, now that you mention it, maybe the OP wasn't asking about how to
JE> correctly print/display non-ASCII characters from his Perl program but
JE> about how to enter them on his keyboard in the editor. Two very
JE> different things.
JE> The easiest way would be to switch the keyboard into Spanish mode. How
JE> to do that depends on your OS.
JE> If you have to type text in multiple different languages frequently you
JE> might want to check out those keyboards that have little LCDs on the
JE> keys, which change to actually match the national layout for the current
JE> keyboard mode.

As a follow up I wanted to mention my favorite tools for this.

Yudit is a good Unicode editor that can do a lot of edge cases for
input.

Yet another way is to use Emacs with Quail. It lets you set up
transliterated inputs; for example with quail-cyrillic-translit I can
type `къща №5' with k ~ /t a /no 5

There are equivalent methods for Western European inputs:
latin1-alt-postfix for example has this table (from the docs):

| postfix | examples
------------+---------+----------
acute | ' | a' -> á
grave | ` | a` -> à
circumflex | ^ | a^ -> â
diaeresis | \" | a\" -> ä
tilde | ~ | a~ -> ã
cedilla | / | c/ -> ç
nordic | / | d/ -> ð t/ -> þ a/ -> å e/ -> æ o/ -> ø
others | /<> | s/ -> ß ?/ -> ¿ !/ -> ¡
| various | << -> « >> -> » o_ -> º a_ -> ª

This is not directly related to Perl, but it's really hard (IMHO) to set
up easy input of UCS characters in a consistent way across platforms, so
inside Emacs Quail is a pretty good solution. I hope someone finds it
useful.

Ted

Posted by RedGrittyBrick on June 23, 2008, 10:22 am
Please log in for more thread options
Ted Zlatanov wrote:
>
> JE> Oh, now that you mention it, maybe the OP wasn't asking about how to
> JE> correctly print/display non-ASCII characters from his Perl program but
> JE> about how to enter them on his keyboard in the editor. Two very
> JE> different things.
> JE> The easiest way would be to switch the keyboard into Spanish mode. How
> JE> to do that depends on your OS.
> JE> If you have to type text in multiple different languages frequently you
> JE> might want to check out those keyboards that have little LCDs on the
> JE> keys, which change to actually match the national layout for the current
> JE> keyboard mode.
>
> As a follow up I wanted to mention my favorite tools for this.
>
> Yudit is a good Unicode editor that can do a lot of edge cases for
> input.
>
> Yet another way is to use Emacs with Quail. It lets you set up
> transliterated inputs; for example with quail-cyrillic-translit I can
> type `къща №5' with k ~ /t a /no 5
>
> There are equivalent methods for Western European inputs:
> latin1-alt-postfix for example has this table (from the docs):
>
> | postfix | examples
> ------------+---------+----------
> acute | ' | a' -> á
> grave | ` | a` -> à
> circumflex | ^ | a^ -> â
> diaeresis | \" | a\" -> ä
> tilde | ~ | a~ -> ã
> cedilla | / | c/ -> ç
> nordic | / | d/ -> ð t/ -> þ a/ -> å e/ -> æ o/ -> ø
> others | /<> | s/ -> ß ?/ -> ¿ !/ -> ¡
> | various | << -> « >> -> » o_ -> º a_ -> ª
>
> This is not directly related to Perl, but it's really hard (IMHO) to set
> up easy input of UCS characters in a consistent way across platforms, so
> inside Emacs Quail is a pretty good solution. I hope someone finds it
> useful.
>

In vim `:help digraphs`.

--
RGB

Similar ThreadsPosted
I can't print spanish characters on console December 8, 2006, 7:07 pm
print cyriilic (UTF-8) characters with PERL on HTML page September 13, 2006, 4:59 am
How to print "0A" LF or "03" ETX characters to a filehandle October 17, 2006, 4:24 pm
how can I print multiple lines without escaping '$' and other characters? September 29, 2006, 8:38 pm
Print Subject without characters Just Numbers using POP3Client. Please Help April 10, 2007, 11:27 pm
Adding a delimiter inbetween number characters and letter characters January 12, 2005, 9:25 am
(",) Print This! Press [Ctrl][P] Keys To Print... >> http://www.phpbbserver.com/phpbb/viewtopic.php?t=2&mforum=anysubjectchat < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < May 30, 2005, 2:05 pm
* * * Please Read And/Or Print This! * * * Press [Ctrl][P] Keys On Your Keyboard To Print >> June 1, 2004 8:24:38 pm >> http://115639.aceboard.net/forum2.php?rub=158&cat=61&login=115639&page=0#id96 << * * * * * * * * * * * * * * * * * * * * * * * * * * * June 1, 2005, 6:24 pm
Perl returning mucky characters to a shell August 2, 2004, 3:20 pm
Defining a string/array with perl characters September 27, 2004, 8:10 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap