(unknown)
am 06.02.2008 12:00:50 von VDI Freemail
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 =3D 'PHOENIX';
$Benutzername =3D 'username';
$PW =3D 'password';
$dbh =3D DBI->connect("dbi:Oracle:$DBname", $Benutzername, $PW )
|| die "Kann nicht mit der Datenbank verbinden:
$DBI::errstr";
use Tk;
$top =3D MainWindow->new(-title =3D> 'Test german characters');
$Text =3D 'german ä ö ü ß Ä Ö Ü'; #### text to insert
$top->Entry(-state =3D> 'normal', -width =3D> 70,
-font =3D> '{Arial} 10 normal roman',
-textvariable =3D> \$Entryvar,
)->pack();
$top->Button(-text =3D> 'Data from entry',
-background =3D> 'yellow1',
-command =3D> sub{&Daten_aktualisieren($Entryvar)}
)->pack(); =
# inserts "german ä ö ü =C3Y ÿ =C3=
=BF ÿ"
$top->Button(-text =3D> 'Data from program', =
#### wrong
-background =3D> 'yellow1',
-command =3D> sub{&Daten_aktualisieren($Text)}
)->pack(); =
# inserts "german ä ö ü ß Ä Ö Ü"
MainLoop; =
###### OK
sub Daten_aktualisieren
{ $t=3D$_[0];
$sql =3D "UPDATE ARSTAMM_BEZ SET TEXT2 =3D '$t' WHERE ARTNR =3D 'testmm =
' ";
print "$sql\n";
$sth_DATA =3D $dbh->prepare($sql);
$rc =3D $sth_DATA->execute();
if ( $rc )
{print "OK\n";}
else
{print "Error $sql\n" . $dbh->errstr . "\n"; }
return;
}
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re:
am 07.02.2008 08:36:39 von nomura
--===============1818682985==
Content-Type: text/plain; charset="ISO-2022-JP"
Content-Transfer-Encoding: 7bit
Hello.
I am not sure... How it comes changing this line to next lines?
> $Text = 'german text'; #### text to insert
> $Text = 'german text'; #### text to insert
> use Encode qw/decode/;
> $Text = decode('iso-8859-?', $Text);
? for your encoding.
On Wed, 6 Feb 2008 12:00:50 +0100
VDI Freemail wrote:
> 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 $Bg".".!,(B $B%H(B $B%h(B $B%o(B'; #### 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 $B%F!"(B $B%F%+(B $B%F%7(B $B%F(BY $B%F%=(B $B%F%=(B $B%F%=(B"
> $top->Button(-text => 'Data from program',
> #### wrong
> -background => 'yellow1',
> -command => sub{&Daten_aktualisieren($Text)}
> )->pack();
> # inserts "german $Bg".".!,(B $B%H(B $B%h(B $B%o(B"
> 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
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
> __________ NOD32 2852 (20080206) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://canon-sol.jp/product/nd
>
------------------------------------------------------------ ---------
gpg public key
https://hagi.ir-alt.co.jp/home/nomura/public-nomura.asc
$BLnB<(B
------------------------------------------------------------ ---------
--===============1818682985==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1818682985==--