I got the information from the sql admins that the DB is installed with default encoding for sql and has the collation: SQL_Latin1_General_CP1_CI_AS and they say that this represents UCS-2 and/or UTF-16.Considering above the case, please let me know what kind of changes needs to be done to the script?Thanks.
use Encode;eval {Encode::from_to($your_string, 'utf-16le', 'utf-8', Encode::FB_CROAK);};if ($@) { my $error_message = qq(Can Not Encode to UTF-8: $@); # Log out $error_message}
my $count=0;foreach my $row (@items){ my $id = @$row[0]; my $name = @$row[1]; $logger->debug("INITIAL ID: $id"); $logger->debug("INITIAL Name: $name"); eval {Encode::from_to($name, 'utf-16le', 'utf-8', Encode::FB_CROAK);}; #eval {Encode::from_to($name, 'ucs-2', 'utf-8', Encode::FB_CROAK);}; if ($@) { my $error_message = qq(Can Not Encode to UTF-8: $@); $logger->debug("$error_message"); # Log out $error_message }print <<"END";$nameEND$count=$count+1;}
Thanks Boris.When I do the encoding conversion from 'utf-16le' to utf-8', I am getting the following error:Can Not Encode to UTF-8: Unknown encoding 'utf-16le' at \Programs\Interwoven\TeamSite\httpd\iw-bin\test_db_enc_script.ipl line 186
hmmm...didn't work out Boris.Result: Can Not Encode to UTF-8: Unknown encoding 'utf-16' at \Programs\Interwoven\TeamSite\httpd\iw-bin\test_db_enc_script.ipl line 188Am wondering is there any environment variable that I need to set.