use QString::fromLocal8Bit instead of QString::fromLatin1

This ensures that non-Latin 1 characters are handled correctly.
fix handling of non-ASCII characters in command-line arguments

This was due to QString::fromLocal8Bit not working correctly
when parsing the command-line arguments. The initialization
of QCoreApplication should ideally happen as soon as possible,
but it has to be delayed in our case as we can only know whether
to initialize in graphics mode depending on the --use-xserver
command-line option.

To work this around, we call setlocale(LC_ALL, "") before parsing
the command-line arguments which ensures that the system codec
works correctly as per
http://thread.gmane.org/gmane.comp.lib.qt.general/43325/focus=43339

Fixes #1825 and the duplicates as well (#1990, #2002)