in reply to Re: system function not handling string properly
in thread system function not handling string properly

$link does not contain any such characters. If you run the script on the sample sql file I linked to, the result is "www.youtube.com/watch?v=mark"
  • Comment on Re^2: system function not handling string properly

Replies are listed 'Best First'.
Re^3: system function not handling string properly
by choroba (Cardinal) on Sep 06, 2013 at 21:31 UTC
    Try running a hexdump on the string. It seems it is UTF-16 encoded, there is a zero byte after each character. echo probably takes the null char as the end of string as in C.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      In this case I would be really interested in

      print Dumper($link);

      ;)

        Normal Data::Dumper returns
        $VAR1 = 'www.youtube.com/watch?v=mark';

        but after setting

        $Data::Dumper::Useqq = 1;

        I get

        $VAR1 = "w\0w\0w\0.\0y\0o\0u\0t\0u\0b\0e\0.\0c\0o\0m\0/\0w\0a\0t\0c\0h +\0?\0v\0=\0m\0a\0r\0k\0";

        To get the correct output, I have to

        use Encode; $link = decode('utf-16-le', $link);
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ