http://www.perlmonks.org/?node_id=719216
was useful for me.
especially the iconv tip (but i was going the other way , exporting
from mssql, which gives utf-16 files )


if that doesn't work, there's probably something in python ;-)
-- vish



2009/8/3 Nicky Pappo <[email protected]>:
> 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
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to