Hello,

Unless you changed the default settings, mysql most probably
works in the Latin-1 (ISO8859_1) character encoding.

What is the character encoding of your file?

How are you displaying the results from your select
commant? (how did you conclude that the text is being
garbaged after insert?)



-- 
Shlomo Yona
[email protected]
http://yeda.cs.technion.ac.il/~yona/

On Mon, 3 Aug 2009, Nicky Pappo wrote:

> Hi,
> I am trying to read a file (Hebrew characters), and store data from it
> thought DBI into SQL server.
> Characters are garbaged after the Insert command.
> Any ideas?
>
> Thanks Nicky Pappo
> [email protected]
>
>
> Here the relevant piece from the code:
>
>
> #!/usr/bin/perl
>
> use strict;
> use DBI;
>
>
> my $dbconnect="SQLEXPRESS";  #the odbc connection
> my $paramvalue = "";
> my $filename="1";
> my $paramtype="type";
> my $sqlstatement;
>
> open(DAT, "test.txt" ) || die("Could not open file!");
> binmode DAT, ":utf8";
> while (<DAT>){
>    $paramvalue .= $_;
> }
>
>
> my $dbh = DBI->connect("dbi:ODBC:$dbconnect");
>
>
> $sqlstatement= "insert into parameters
> (filename,ParameterType,ParameterValue)
> values('$filename','$paramtype',N'$paramvalue')";
> #setUTF8($sqlstatement);
> my $sth = $dbh->prepare($sqlstatement);
> $sth->execute();

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to