[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Windows and Unicode

From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Windows and Unicode
Date: Sat, 12 Oct 2013 02:49:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130821 Icedove/17.0.8

Hello, all. I've been experimenting in porting a GNU project to Windows
while preserving Unicode capability. Prepending _t everywhere like
Microsoft suggest is hardly an option due to change of code it requires
and subtle problems with it. E.g. consider code:

s = malloc (strlen (a) + strlen (b) + 3);
p = stpcpy (s, a);
*p++ = '/';
p = stpcpy (s, b);
*p = '\0'

If you just replace char with _tchar missing sizeof (char) multiplier in
malloc will make your program crash.
So I went another way: keeping the code as-is but adding following

around main to have unicode argv
around all fs functions receiving filename as argument
around console and file functions doing conversion if std* point to console.

My next problem is that gettext assumes that on windows program wants
ANSI windows codepage and never gives utf8. There seems to be no way to
override this.

Would be an option to accept the patches to do the wrapping as described
and have a way to override gettext charset by calling a special function
gettext_set_charset ("utf-8")
gettext_force_utf8 ();

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]