Replace fopen() with g_fopen() in project.c (4 calls), tooltable.c
(1 call) so that filenames containing non-ASCII characters (e.g. ö, ü,
CJK) are opened correctly on Windows, where fopen() uses the system
codepage but g_fopen() converts UTF-8 to wide-char internally.
On Windows, convert argv from the system codepage to UTF-8 via
g_locale_to_utf8() so that CLI-supplied paths round-trip through GLib
file functions correctly.
Use g_filename_display_basename() instead of g_path_get_basename() for
the window title so that non-ASCII basenames render properly.
Set an explicit glib-2.0>=2.6 minimum in CMakeLists.txt to document the
dependency on g_fopen() and g_filename_display_basename().
Closes gerbv#234
Summary
Tier 1 fix for non-ASCII file path handling on Windows.
fopen()withg_fopen()inproject.c(4 calls) andtooltable.c(1 call) so that files with non-ASCII characters in their paths (e.g.ö,ü, CJK) open correctly on Windowsargvfrom system codepage to UTF-8 viag_locale_to_utf8()on Windows so CLI-supplied paths work with GLib file functionsg_filename_display_basename()instead ofg_path_get_basename()for the window title so non-ASCII basenames render properlyglib-2.0>=2.6minimum in CMakeLists.txt to document the dependency ong_fopen()andg_filename_display_basename()Closes #234
Details
On Windows,
fopen()interprets filenames using the system codepage (e.g. Windows-1252), which cannot represent characters outside that codepage. GLib'sg_fopen()internally converts UTF-8 paths to wide-char via_wfopen(), handling all Unicode filenames correctly.Similarly,
argvon Windows is encoded in the system codepage. Since GLib functions expect UTF-8, the fix converts eachargventry viag_locale_to_utf8()early inmain(). This uses the conservativeg_locale_to_utf8()(available in all GLib 2.x) rather thang_win32_get_command_line()(which requires GLib 2.40+).Scope
This is a tier 1 fix covering the straightforward cases. Not touched (separate work):
export-image.c— would need a stream API refactorscheme.c— embedded TinyScheme interpreterlrealpath.c— Win32 path canonicalizationTest plan
Löten.gbr) open as before