Fixed bug with non latin-1 characters in path

The paths where converted to standard strings using the latin-1 codec.
We now use toUtf8().data() to use the utf-8 codec instead.