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 143433 - get MIME type wrong for Multi-byte filename
get MIME type wrong for Multi-byte filename
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: MIME data
unspecified
Other Linux
: High major
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
: 141818 (view as bug list)
Depends on:
Blocks: 160959
 
 
Reported: 2004-05-31 10:49 UTC by Yong Sun
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
fix (1.28 KB, patch)
2004-12-12 20:58 UTC, Marco Pesenti Gritti
none Details | Review

Description Yong Sun 2004-05-31 10:49:29 UTC
* login into chinese locale (non UTF-8, e.g., GB18030)
 * double click on one ".doc" icon which filename consists of some multi-byte chars.
   e.g. "da, jia"
Comment 1 Yong Sun 2004-05-31 10:49:44 UTC
gnome_vfs_get_file_mime_type() ... -> ... -> _xdg_glob_has_lookup_file_name(),
this function will lookup the extention of the given path, but it treats the
path as UTF-8 encoding, so when it skips utf-8 chars to lookup '.', the '.'
maybe incorrectly skipped. (An array _xdg_utf8_skip[] will be used to determin
skipping pace.)

for (ptr = file_name; *ptr != '\000'; ptr++ /*= _xdg_utf8_next_char (ptr)*/)
{
    if (*ptr == '.')
    {
        mime_type = (_xdg_glob_hash_node_lookup_file_name
(glob_hash->simple_node, ptr, FALSE));
        if (mime_type != NULL)
            return mime_type;
    }
}

... ...
Comment 2 Yong Sun 2004-07-19 22:51:41 UTC
Oops, a typo, should be _xdg_glob_hash_lookup_file_name().
Comment 3 Marco Pesenti Gritti 2004-12-10 15:25:38 UTC
*** Bug 141818 has been marked as a duplicate of this bug. ***
Comment 4 Marco Pesenti Gritti 2004-12-10 15:26:46 UTC
This one is probably a pain to fix because we cannot use glib conversion api :((
Comment 5 Marco Pesenti Gritti 2004-12-10 15:30:02 UTC
Actually maybe gnome-vfs could do the conversion before passing it to xdgmime.
Comment 6 Marco Pesenti Gritti 2004-12-10 16:11:17 UTC
The thing is that we cannot do a conversion because this apply to remote
filenames too and we dont know the encoding for these.
Comment 7 Marco Pesenti Gritti 2004-12-12 20:09:50 UTC
Talked with alex about this. I think we need to fix both gnome-vfs and xdgmime
to not assume it's utf8. That's possible because in all encodings actually used
for the filesystem you can assume ascii caracters are actually represented as
ascii (i.e. a strchr('.') will work correctly).
Comment 8 Marco Pesenti Gritti 2004-12-12 20:58:31 UTC
Created attachment 34771 [details] [review]
fix