Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2017-04-20 Thread Thomas Martitz
I wonder, what makes this Windows-specific? On-disk file names can be arbitrary encoding on all platforms, right? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1258#issuecomment-29560702

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-12-06 Thread Enrico Tröger
@cshu still interested in this PR? I think it would be cool and the sooner we get it merged (regarding the next release) the better it is. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-12-06 Thread cshu
@eht16 No, I leave it to you. This PR is a small change. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1258#issuecomment-264706407

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Enrico Tröger
eht16 commented on this pull request. > +{ + int num_arg; + LPWSTR *szarglist = CommandLineToArgvW(GetCommandLineW(), &num_arg); + char **utf8argv = g_new0(char *, num_arg + 1); + int i = num_arg; + while(i) + { + i--; + utf8argv[i]

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Enrico Tröger
eht16 commented on this pull request. > @@ -1231,6 +1230,9 @@ gint main_lib(gint argc, gchar **argv) #endif gtk_main(); +#ifdef G_OS_WIN32 + win32_free_argv_made_in_utf8(argc, argv); Yeah, also nice. But I'd still vote to put the Windows specific code in the first G_OS_WIN32 b

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Colomban Wendling
b4n commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) +{ + int num_arg; + LPWSTR *szarglis

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Matthew Brush
codebrainz commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) +{ + int num_arg; + LPWSTR *s

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Colomban Wendling
b4n commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) +{ + int num_arg; + LPWSTR *szarglis

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Matthew Brush
codebrainz commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) +{ + int num_arg; + LPWSTR *s

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread elextr
> (Or we could please @codebrainz and rewrite using GApplication which does > this for us… but that would be a lot of changes :)) or maybe qapplication ;-P -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Colomban Wendling
Hum, the [docs on `g_win32_get_command_line()`](https://developer.gnome.org/glib/unstable/glib-Windows-Compatibility-Functions.html#g-win32-get-command-line) mention that [`g_option_context_parse()`](https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#g-option-context-p

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Colomban Wendling
b4n commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) Actually recent GLib (2.40+) have `g_win32_get_

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-09 Thread Colomban Wendling
b4n requested changes on this pull request. The idea seems good, and without having actually tested the PR I can confirm from other tests I did yetserday that the combination of `GetCommandLineW()` and `CommandLineToArgvW()` seems to work just fine. > +{ + int num_arg; + LPWSTR *sza

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-08 Thread Enrico Tröger
eht16 requested changes on this pull request. Thanks for the hints for reproducing. After being able to reproduce the issue and testing your changes, it worked fine. Thanks. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-11-08 Thread Enrico Tröger
eht16 commented on this pull request. > @@ -1032,4 +1032,31 @@ gchar *win32_get_user_config_dir(void) return g_build_filename(g_get_user_config_dir(), "geany", NULL); } + +void win32_make_argc_and_argv_in_utf8(gint *pargc, gchar ***pargv) Maybe `win32_convert_argv_to_utf8()` would be

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-27 Thread cshu
I moved most code to win32.c, and included argv[0] in conversion. Different file systems can use various encoding for filenames. (NTFS, FAT32, etc.) But `CommandLineToArgvW` always provide filenames in UTF-16. So in the case of windows api functions, underlying file system usually should not be

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-27 Thread cshu
@cshu pushed 1 commit. e9e7c11 most-logic-in-win32 -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/geany/geany/pull/1258/files/1dd0769d7ea77eb54af0a61238370c95e56cec9f..e9e7c117be223e23e05ea9e0f97b00ecb17a4afc

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-24 Thread Enrico Tröger
In the initial description you talk about "unicode". Unicode characters can be saved using different encodings, this can be UTF-8, UTF-16 and so on. We cannot know which encoding the filename of a file on disk was used. Yes, we can assume UTF-16 or we can assume UTF-8, maybe even both by trying.

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-16 Thread cshu
This can be reproduced when filename character is not supported by system locale's encoding. E.g. When system locale is "English (United States)", double clicking `read我.txt` opens an empty tab in Geany with name `read?.txt`. The file is not really opened. -- You are receiving this because you

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-16 Thread Enrico Tröger
I think we should handle the argv[0] issue as well. But only if it is necessary at all, see below. Can you provide a test case for this? I can open files on a NTFS drive with non-ASCII characters in their path in Geany either from the command line (cmd.exe) as well as using the "Open With" Expl

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-14 Thread cshu
I created the pull request mainly for the convenience of "open with" Geany on Windows On the other hand it should be very rare for Geany's installation path to contain unicode character. And I'd like to let geany launch as fast as possible when I press Win+R and type `geany`. So I avoided the c

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-13 Thread Stefan Oberhumer
I'm not sure if it's necessary but have you checked you don't have to handle argv[0] the same way ? (Eg geany is in an directory containing unicode characters) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.c

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-06 Thread cshu
Should work, regardless of locale settings. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1258#issuecomment-251909482

Re: [Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-06 Thread elextr
Does this work if the locale is a non-unicode code page? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1258#issuecomment-251900323

[Github-comments] [geany/geany] Provide utf-8 command line arguments on Windows (#1258)

2016-10-06 Thread cshu
Windows filenames (NTFS) may contain unicode characters. Passing the filename to `geany.exe` as command line argument does not open the file. At startup, it can get all arguments in UTF-16, and convert them to UTF-8. So filenames containing unicode characters can be passed to `geany.exe`. You ca