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 524314 - g_convert() on WIN32 implicitly converts full width alphanumerics into half width
g_convert() on WIN32 implicitly converts full width alphanumerics into half w...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.16.x
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-03-25 14:37 UTC by Yoshiki Yazawa
Modified: 2008-04-02 02:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yoshiki Yazawa 2008-03-25 14:37:26 UTC
Please describe the problem:
After glib for WIN32 has switched to win_iconv, g_convert() began converting full width alphanumerics into half width implicitly. For example, 

g_convert("abc", -1, "ISO-8859-1", "UTF-8", NULL, &msglen, NULL)

result in "abc" on WIN32 instead of NULL on other environments. This behavior is different from ever and is singular among other platforms. I think it should be normalized.


Steps to reproduce:
1. Examine the returned string from g_convert() on WIN32.


Actual results:
In the example above, half width alphanumeric string "abc" will be returned.

Expected results:
NULL is expected since full width utf8 string "abc" cannot be represented in ISO-8859-1.

Does this happen every time?
Every time.

Other information:
I guess WC_NO_BEST_FIT_CHARS should be supplied as the second argument to WideCharToMultiByte().
Comment 1 Tor Lillqvist 2008-04-02 02:49:49 UTC
Fixed in trunk and glib-2-16:

2008-04-02  Tor Lillqvist  <tml@novell.com>

	Bug 524314 - g_convert() on Win32 implicitly converts full width
	alphanumerics into half width
	
	* glib/win_iconv.c: Update from Yukihiro Nakadaira. Use
	WC_NO_BEST_FIT_CHARS flag for WideCharToMultiByte() unless the
	//translit flag was suffixed to the codeset name.

	* glib/gconvert.c: Include win_iconv.c earlier so that its
	definition of WINVER before it includes <windows.h> is used.