diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index 026cac99cf..343a8978cb 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -373,7 +373,7 @@ class Win32Freeze(Command, WixMixIn): src = self.j(self.src_root, 'setup', 'installer', 'windows', 'portable.c') obj = self.j(self.obj_dir, self.b(src)+'.obj') - cflags = '/c /EHsc /MT /W3 /Ox /nologo /D_UNICODE'.split() + cflags = '/c /EHsc /MT /W3 /Ox /nologo /D_UNICODE /DUNICODE'.split() if self.newer(obj, [src]): self.info('Compiling', obj) diff --git a/setup/installer/windows/portable.c b/setup/installer/windows/portable.c index 05763bc303..1a2a89df7b 100644 --- a/setup/installer/windows/portable.c +++ b/setup/installer/windows/portable.c @@ -2,8 +2,14 @@ #define UNICODE #endif +#ifndef _UNICODE +#define _UNICODE +#endif + + #include #include +#include #include #define BUFSIZE 4096 @@ -32,7 +38,7 @@ void show_last_error_crt(LPCTSTR preamble) { int err = 0; _get_errno(&err); - _wcserror_s(buf, BUFSIZE, err); + _tcserror_s(buf, BUFSIZE, err); show_detailed_error(preamble, buf, err); } diff --git a/src/calibre/ebooks/mobi/writer2/main.py b/src/calibre/ebooks/mobi/writer2/main.py index 4d53b7c3ef..2c57a9e461 100644 --- a/src/calibre/ebooks/mobi/writer2/main.py +++ b/src/calibre/ebooks/mobi/writer2/main.py @@ -544,7 +544,8 @@ class MobiWriter(object): ''' Write the PalmDB header ''' - title = ascii_filename(unicode(self.oeb.metadata.title[0])) + title = ascii_filename(unicode(self.oeb.metadata.title[0])).replace( + ' ', '_') title = title + (b'\0' * (32 - len(title))) now = int(time.time()) nrecords = len(self.records)