æ are probably 2 bytes representing utf8 encoding for �. Try
use Unicode::String; my $u = utf8($word); $word = $u->latin1(); before insertion -----Original Message----- From: Allan Juul [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:58 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: inserting special characters hello, thanks for the reply - still stuck. i have tried all combs of "use/no bytes and use/no utf8" to me it looks like my chars get altered around the execute method: this trace exeample is one single danish letter � which get converted to æ could it be something to do with collation or maybe locale ? any thoughts much appriciated /allan trace excerpt : --------------- <- prepare= DBI::st=HASH(0x1f653d4) at C:\Documents and Settings\aju\Skrivebord\util\gyldendal\xml.pl line 140 via C:\Documents and Settings\aju\Skrivebord\util\gyldendal\xml.pl line 48 -> execute for DBD::ODBC::st (DBI::st=HASH(0x1f653d4)~0x1625170 'æ' '309001050' 'xml') thr#16243ac ^^ bind 1 <== 'æ' (attribs: ), type 0 --------------- > SQL Server 2000 > windows 2000 > perl 5.8 > > > i have an annoying problem with sql server, maybe someone have > encountered something similar - it concerns special (danish) > characters that im unable to insert correctly in the db table (they > seem to be escaped with an even stranger char in the db) > > if i print the words that i want to insert to a txtfile i can see > that they are correct at that point > > > this works: > ---------- > my $word = 'hardcoded with special chars: ���'; > my $sql = "insert into $table (word) values (?)"; > my $sth = $dbh->prepare( $sql ); > $sth->execute($word); > > > this doesn't work: > ----------------- > foreach my $word (keys %hash) { > my $sql = "insert into $table (word) values (?)"; > my $sth = $dbh->prepare( $sql ); It is more effecient to put the prepare() call outside the loop. > $sth->execute($word); > print OUT "$sql ($word)\n"; # looks perfect in the txtfile I'd be interested to see what length($word) is here. > } > > > > anyone can point me in the right direction? Try combinations of use/no bytes and use/no utf8 to see if they change the result. `perldoc perluniintro` may be interesting. Med venlig hilsen KRAK Allan Juul Web-udvikler ITProduktion Virumg�rdsvej 21 2830 Virum Tlf.: 45956500 Direkte: www.krak.dk Disclaimer - 26-06-2003 Denne e-mail og eventuelle filer der er medsendt kan indeholde fortroligt materiale, som kun er beregnet for adressaten. Den m� derfor ikke udleveres eller kopieres til nogen anden. Har du ved en fejltagelse modtaget denne e-mail, beder vi dig om straks at meddele afsenderen eller Krak dette og destruere mailen. Da e-mails kan �ndres ad elektronisk vej, p�tager Krak sig intet ansvar for denne meddelelse eller eventuelle vedh�ftede filer.
smime.p7s
Description: S/MIME cryptographic signature
