After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 543789 - g_iconv failure on win9x
g_iconv failure on win9x
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: win32
2.16.x
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2008-07-19 22:35 UTC by Greg Sharp
Modified: 2008-07-21 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Greg Sharp 2008-07-19 22:35:05 UTC
Please describe the problem:
Windows 98, MSVC 6 compiler.  Using the program below gives correct results for glib 2.12 (gnu iconv) and incorrect glib 2.16.X (win_iconv).

File: testme.c
--------------
int main (int argc, char* argv[]) {
    GIConv giconv;
    GError *error = 0;
    gchar* out;
    char* from_codeset = argv[1];
    char* to_codeset = argv[2];

    giconv = g_iconv_open (to_codeset, from_codeset);
    if (giconv == (GIConv) -1) {
	printf ("g_iconv_open error\n");
	return 0;
    }

    out = g_convert_with_iconv ("A", 1, giconv, 0, 0, &error);

    if (error && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) {
	printf ("Illegal sequence\n");
	return 0;
    }
    g_iconv_close (giconv);
    printf ("Successful conversion: %s\n", out);
    return 0;
}

Output for glib 2.12:
---------------------
C:\Program Files\Streamripper>d:testme CP1252 UTF-8
Successful conversion: A
C:\Program Files\Streamripper>d:testme UTF-8 CP1252
Successful conversion: A
C:\Program Files\Streamripper>d:testme UTF-8 US-ASCII
Successful conversion: A

For glib 2.16:
---------------------
C:\Program Files\Streamripper>d:testme CP1252 UTF-8
Successful conversion: A
C:\Program Files\Streamripper>d:testme UTF-8 CP1252
Illegal sequence
C:\Program Files\Streamripper>d:testme UTF-8 US-ASCII
g_iconv_open error

In addition, the glib implementation of win_iconv has disabled the ability to workaround by using gnu iconv through use of WINICONV_LIBICONV_DLL environment variable.  The only workaround I can find is to go back to using iconv() directly.


Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?
yes

Other information:
Comment 1 Tor Lillqvist 2008-07-20 07:57:10 UTC
GLib 2.16 is not supposed to even work on Windows 98, I am a bit amazed that you manage to run your test program on it. Most likely any program that would use a more realistic set of GLib APIs would fail badly.

(Your test case works fine on XP compiled with either gcc or MSVC6.)

> the glib implementation of win_iconv has disabled the ability
> to workaround by using gnu iconv through use of WINICONV_LIBICONV_DLL

Well, I would say "hasn't enabled" instead of "disabled", but yes. I don't see the need for it. (Given that GLib 2.16 is not even supposed to work on Windows 9x, for instance.)
Comment 2 Greg Sharp 2008-07-21 14:19:44 UTC
I saw the note about windows 98 on the web site, but I thought that only applies to gtk+.  I am only using glib.

Can you explain why you think windows 98 would not work?  For example, which sections of glib would rely on win32 calls not implemented in win98?  

I have been using it for a while, and didn't encounter any problems until now.
Comment 3 Tor Lillqvist 2008-07-21 14:37:44 UTC
> Can you explain why you think windows 98 would not work? 

Because GLib explicitly uses the wide character versions of many APIs that isn't supported on Win9x. No attempts at all have been made to keep it working on Win9x since 2.8 or so. If it works to some extent, that is just coincidental.

> didn't encounter any problems until now.

You were just lucky then.
Comment 4 Tor Lillqvist 2008-07-21 14:43:13 UTC
Sorry, I misremembered: It is from 2.14 that GLib uses just the wide-character APIs. So if you stick to 2.12, that should then work on Win9x.
Comment 5 Greg Sharp 2008-07-21 15:08:23 UTC
Thanks so much for the information.  As you indicated, I was trying to upgrade from 2.12 to 2.16 when I found this problem.

I guess I'm in a bit of a bad situation now.  One of the reasons I chose glib was its good compatibility.

If you would consider anything I can help to restore win98 to glib, please think it over and let me know.  Continuing with glib would be my preferred option.

-Greg
Comment 6 Tor Lillqvist 2008-07-21 16:00:28 UTC
You could backport the new functionality (or bug fixes) in 2.16 that you need to 2.12 and build it yourself...?
Comment 7 Greg Sharp 2008-07-21 17:02:13 UTC
Yes, I think I will try building a custom version, as you suggest.  Thanks.