I would like to enter data for the database over the Tk surface. There
is no problem if the data are created in the program. If I enter
German characters with entry in Tk, wrong characters are written in
the database.
Can anybody help me?
yours sincerely
Manfred
#
use DBI;
$DBname = 'PHOENIX';
$Benutzername = 'username';
$PW = 'password';
$dbh = DBI->connect("dbi:Oracle:$DBname", $Benutzername, $PW )
|| die "Kann nicht mit der Datenbank verbinden:
$DBI::errstr";
use Tk;
$top = MainWindow->new(-title => 'Test german characters');
$Text = 'german ä ö ü ß Ä Ö Ü'; #### text to insert
$top->Entry(-state => 'normal', -width => 70,
-font => '{Arial} 10 normal roman',
-textvariable => \$Entryvar,
)->pack();
$top->Button(-text => 'Data from entry',
-background => 'yellow1',
-command => sub{&Daten_aktualisieren($Entryvar)}
)->pack();
# inserts "german ä ö ü ÃY ÿ ÿ ÿ"
$top->Button(-text => 'Data from program',
#### wrong
-background => 'yellow1',
-command => sub{&Daten_aktualisieren($Text)}
)->pack();
# inserts "german ä ö ü ß Ä Ö Ü"
MainLoop;
###### OK
sub Daten_aktualisieren
{ $t=$_[0];
$sql = "UPDATE ARSTAMM_BEZ SET TEXT2 = '$t' WHERE ARTNR = 'testmm
' ";
print "$sql\n";
$sth_DATA = $dbh->prepare($sql);
$rc = $sth_DATA->execute();
if ( $rc )
{print "OK\n";}
else
{print "Error $sql\n" . $dbh->errstr . "\n"; }
return;
}
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs