On Wed, 25 Jun 2003 17:36:02 +0200 allan juul <[EMAIL PROTECTED]> wrote:

> 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.

-- 
Mac :})
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to