dalibo / sqlserver2pgsql

Migration tool to convert a Microsoft SQL Server Database into a PostgreSQL database, as automatically as possible
http://dalibo.github.io/sqlserver2pgsql
GNU General Public License v3.0
515 stars 117 forks source link

Empty string, empty guess at ./sqlserver2pgsql.pl line 1506. #165

Closed IvanSpetsyian closed 2 years ago

IvanSpetsyian commented 2 years ago

How to reproduce: I following the instructions on this article https://nuvalence.io/blog/microsoft-sql-server-to-postgresql-migration-using-sqlserver2pgsql

When i start the container i get the error: Empty string, empty guess at ./sqlserver2pgsql.pl line 1506.

Do you have some ideas about it?

IvanSpetsyian commented 2 years ago

This context from sqlserver2pgsql.pl

1488  # Reads the dump passed as -f 
1489  # Generates the $object structure
1490  # That's THE MAIN FUNCTION
1491  sub parse_dump
1492  {
1493
1494      # Open the input file or die. This first pass is to detect encoding, and open it correctly afterwards
1495      my $data;
1496      my $file;
1497      open $file, "<$filename" or die "Cannot open $filename";
1498      while (my $line = <$file>)
1499      {
1500          $data .= $line;
1501      }
1502      close $file;
1503
1504      # We now ask guess
1505      my $decoder = guess_encoding($data, qw/iso8859-15/);
1506      die $decoder unless ref($decoder);
IvanSpetsyian commented 2 years ago

I find what was wrong. When i create an image, i put migrate script to another directory. All works great when i move my schema and migration script to correct directories.

beaud76 commented 2 years ago

Nice to hear that you solved your problem. Being in vacation, I was not able to answer sooner, sorry.

IvanSpetsyian commented 2 years ago

Nice to hear that you solved your problem. Being in vacation, I was not able to answer sooner, sorry.

No problem, sorry for my inattention. And thanks for this project.