[Mono-bugs] [Bug 673793] Assembly loading fails when path contains national language characters
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Mar 10 12:57:04 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=673793
https://bugzilla.novell.com/show_bug.cgi?id=673793#c1
--- Comment #1 from Horst Kakuschke <horst at kakuschke.de> 2011-03-10 17:57:03 UTC ---
After some debugging I might have found the culprit...
In mono-filemap.c the function
MonoFileMap *
mono_file_map_open (const char* name)
{
return (MonoFileMap *)fopen (name, "rb");
}
gets called (by do_mono_image_open() in image.c) with an UTF8-encoded filename,
but fopen() needs an ANSI string.
This works fine as long as all characters can be encoded in one byte -
unfortunately this is not the case with certain national language characters.
So I changed mono_file_map_open() to use _wfopen() on Windows and assembly
loading works fine:
MonoFileMap *
mono_file_map_open (const char* name)
{
+#ifdef WIN32
+ gunichar2 * wname = g_utf8_to_utf16(name, -1, 0, 0, 0);
+ MonoFileMap * result = (MonoFileMap *)_wfopen((wchar_t *)wname, L"rb");
+ g_free(wname);
+ return result;
+#else
return (MonoFileMap *)fopen (name, "rb");
+#endif
}
Please check this patch (diff file attached) - if approved, it would be great
to have it in the next release of mono.
Thanks,
Horst Kakuschke
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list