Use QDir::mkdir() in NJClient::SetWorkDir()

Instead of using CreateDirectory() on Windows and mkdir(2) on POSIX, use
QDir::mkdir().

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Use QFile::remove() in DecodeState::~DecodeState()

Instead of using DeleteFile() on Windows and remove(3) on POSIX, use
QFile::remove().

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Drop DebugOutputString() call in NJClient

DebugOutputString() takes wide characters in -DUNICODE builds where this
fails to compile.  Since this debug output is not used much just drop
it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Use QDir::mkdir() in User_Group::SetLogDir()

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add utf8_fopen() wrapper for Unicode paths on Windows

Windows fopen() works in the local encoding.  Since we work in UTF-8
internally the fopen() calls are currently breaking on Windows,
depending on the local encoding and the path.

Use a wrapper that calls the wide-character fopen() function on Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Build with -DUNICODE on Windows

Now that Unicode issues on Windows have been resolved, use the
wide-character APIs.  Previous patches have mostly moved to Qt file I/O
functions that hide this.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Work around NULL QTextCodec::codecForLocale()

QTextStream uses a codec to encode/decode Unicode characters.  On Qt5
Windows builds QTextCodec::codecForLocale() seems to return NULL and
results in a crash inside Qt.

Set the default codec to UTF-8 as a workaround.  Eventually this will go
away when the underlying problem gets fixed in Qt or mxe packages.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>