LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   printing Spanish accent characters in Perl/tk entry widget (https://www.linuxquestions.org/questions/programming-9/printing-spanish-accent-characters-in-perl-tk-entry-widget-289162/)

puedo 02-11-2005 10:52 PM

printing Spanish accent characters in Perl/tk entry widget
 
I am writing a program that stores data in a MySQL database.
This is running on a fully updated Fedora Core 3 system.

Some of this data contains Spanish names like José Nuñez.
I have a Perl/Tk Entry widget to work with the data.
I can type the accented characters into the Entry widget.
I can put it into the MySQL Database. (verified by logging into mysql and doing a select)
I can read it from the MySQL Database into a PERL variable.
I can print it to the console using print "$variable\n";

Writing the variable to the entry wiget causes a problem:
$variable = "José Nuñez";
print "$variable\n"; # this works
$entryWidget->insert('0',$variable);

the Entry widget now displays:
José Nuñez

I have tried using
use Encode::Unicode; and a few others like that.

Anyone have any ideas?

puedo 02-19-2005 02:16 PM

Here is the answer:

use utf8;
$variable = "José Nuñez";
print "$variable\n"; # this works
utf8::decode($variable);
$entryWidget->insert('0',$variable);

all the characters now display correctly in the entry Widget


All times are GMT -5. The time now is 05:56 AM.