use toLocal8Bit for open files with system calls. This is always the right codec and usually utf8 on linux systems.