[M3devel] g_open, GLib wrapper for open()

Dragiša Durić dragisha at m3w.org
Tue Jun 19 09:15:32 CEST 2012


You could not do without. Once you need to access a file from Gtk application, and file is named with at least one Unicode character, you cannot ignore it.

On Jun 18, 2012, at 10:57 PM, Daniel Alejandro Benavides D. wrote:

> Hi all:
> Win32 doesn't support Unicode character code set natively but as separated strings API for both ANSI and Unicode same as C Run-Time library just as you say, not as it's in Windows NT native code set for all strings. But I don't think the Win32 Win98 Is a common type of system daily, so I guess you can be safe without that. Couldn't you?
> Thanks in advance
> 
> --- El dom, 17/6/12, Dragiša Durić <dragisha at m3w.org> escribió:
> 
> De: Dragiša Durić <dragisha at m3w.org>
> Asunto: [M3devel] g_open, GLib wrapper for open()
> Para: "m3devel" <m3devel at elegosoft.com>
> Fecha: domingo, 17 de junio, 2012 13:36
> 
> From doc:
> ===
>  There is a group of functions which wrap the common POSIX functions dealing with filenames (g_open(), g_rename(), g_mkdir(), g_stat(), g_unlink(), g_remove(), g_fopen(), g_freopen()). The point of these wrappers is to make it possible to handle file names with any Unicode characters in them on Windows without having to use ifdefs and the wide character API in the application code.
> 
> The pathname argument should be in the GLib file name encoding. On POSIX this is the actual on-disk encoding which might correspond to the locale settings of the process (or the G_FILENAME_ENCODING environment variable), or not.
> 
> On Windows the GLib file name encoding is UTF-8. Note that the Microsoft C library does not use UTF-8, but has separate APIs for current system code page and wide characters (UTF-16). The GLib wrappers call the wide character API if present (on modern Windows systems), otherwise convert to/from the system code page.
> ===
> Template for g_open is:
> 
> int         g_open                          (const gchar *filename,
>                                              int flags,
>                                              int mode);
> Obviously, I need FilePosix.i3 and descendants, but under Windows… Anyone met/solved this?
> 
> TIA,
> dd
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120619/f99a928e/attachment-0002.html>


More information about the M3devel mailing list