Author Topic: [Solved] Xfce/Thunar has wrong MIME type for Word .doc files  (Read 3546 times)

Offline bascule

  • Full Member
  • ***
  • Posts: 85
[Solved] Xfce/Thunar has wrong MIME type for Word .doc files
« on: December 12, 2010, 10:35:14 AM »
My Xfce Phoenix installation regards *.doc files as plain text, giving them a MIME type of text/plain. Obviously this gives problems in getting them to open directly into OpenOffice, as it tries to open them in Mousepad (my default for text files).

If I change the default for *.doc to OpenOffice Writer, then text files open in OO, which is also not desirable.

I've googled the problem, had a look at some of the config files in /usr/share/mime, but they all seemed a bit scary to be changing and there was quite a difference of opinion on how to fix it, probably due to different Xfce distros handling the whole MIME type issue differently.

I did do the seemingly-safe option of running 'update-mime-database', but with no success.

So, any ideas on how can I fix this problem?
« Last Edit: December 13, 2010, 02:20:59 PM by bascule »
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #1 on: December 12, 2010, 11:07:12 AM »
Hi,

I met with a similar problem recently, and solved it. You can read here:
Wrong files assocation : open files in editor instead of web browser (Solved)

When you see in the file /usr/share/applications/mimeinfo.cache a line such as this one:
Code: [Select]
application/pdf=AdobeReader.desktop;evince.desktop;gimp.desktop;
for example you can change it to:
Code: [Select]
application/pdf=evince.desktop;
The first thing to do is a backup of the file. Then if you damage it while testing it's quite easy to restore. Otherwise I think there is probably a gui method to change the file association in Xfce. This might be when you select a file in Thunar, let's say a .doc file : then you choose "other", then you choose in the list, then before you validate the choice, there should be an option to tick, that states "always open this type of file with this application", or looking very much like this.

Let us know if that helps.



melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline bascule

  • Full Member
  • ***
  • Posts: 85
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #2 on: December 12, 2010, 01:08:14 PM »
When you see in the file /usr/share/applications/mimeinfo.cache a line such as this one:
Code: [Select]
application/pdf=AdobeReader.desktop;evince.desktop;gimp.desktop;

Strange. I can see this file, and it shows as 100 kB in size in Thunar, but it's completely empty when I open it in Mousepad (even as root). I presume I should be able to open it in a text editor?

Otherwise I think there is probably a gui method to change the file association in Xfce. This might be when you select a file in Thunar, let's say a .doc file : then you choose "other", then you choose in the list, then before you validate the choice, there should be an option to tick, that states "always open this type of file with this application", or looking very much like this.

Like I said in my post, I tried that, but because the MIME type is wrong, it always sets both *.txt and *.doc to the same application. So they either both open in Mousepad or both open in Writer.
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #3 on: December 12, 2010, 01:27:39 PM »
When you type as root:
Code: [Select]
# ls -lh /usr/share/applications/mimeinfo.cache
what does it return ?

When you type as root:
Code: [Select]
# more /usr/share/applications/mimeinfo.cache
does it display something ?

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline bascule

  • Full Member
  • ***
  • Posts: 85
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #4 on: December 12, 2010, 02:04:21 PM »
Thanks very much for your help so far, there's plenty in the file...

These two lines in the file indicate that the MIME mappings to applications are correct:
application/msword=openoffice.org3-writer.desktop (all the other MS Word MIME types are also mapped to Writer)
text/plain=mousepad.desktop

The underlying problem seems to remains, however, that the designated MIME type for *.doc is text/plain, rather than application/msword.

Code: [Select]
[root@localhost <user>]# ls -lh /usr/share/applications/mimeinfo.cache
-rw-rw-r-- 1 root root 11K Dec  5 19:15 /usr/share/applications/mimeinfo.cache

[root@localhost <use>]# more /usr/share/applications/mimeinfo.cache
[MIME Cache]
video/vnd.rn-realvideo=gxine.desktop
application/x-cue=audacious2.desktop
image/x-compressed-xcf=gimp.desktop
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=openoffice.org3-calc.desktop
image/x-psd=gimp.desktop
application/x-cd-image=xfburn.desktop;mount-archive.desktop;file-roller.desktop;
application/x-lzop-compressed-tar=file-roller.desktop
application/x-rar=file-roller.desktop
audio/x-speex+ogg=kid3-qt.desktop
image/x-sgi=gimp.desktop
audio/x-s3m=audacious2.desktop
application/x-msi=wine.desktop
image/x-psp=gimp.desktop
application/x-audacity-project=audacity.desktop
application/x-tarz=file-roller.desktop
application/vnd.ms-powerpoint.template.macroenabled.12=openoffice.org3-impress.desktop
application/rss+xml=firefox.desktop
image/x-wmf=gimp.desktop
audio/x-wav=audacious2.desktop;gxine.desktop;audacity.desktop;
application/x-win-lnk=wine.desktop
application/vnd.oasis.opendocument.text-web=openoffice.org3-writer.desktop
application/x-bzip-compressed-tar=mount-archive.desktop;file-roller.desktop;
application/vnd.sun.xml.impress=openoffice.org3-impress.desktop
text/xml=firefox.desktop;chromium-browser.desktop;
application/vnd.ms-word=openoffice.org3-writer.desktop
application/vnd.google-earth.kml+xml=Google-googleearth.desktop
image/x-pcx=shutter.desktop
application/x-ace=file-roller.desktop
application/ogg=audacious2.desktop;gxine.desktop;kid3-qt.desktop;audacity.desktop;
audio/x-pn-aiff=gxine.desktop
application/x-xz=file-roller.desktop
application/x-lzip=file-roller.desktop
audio/x-xm=audacious2.desktop
application/vnd.oasis.opendocument.graphics=openoffice.org3-draw.desktop
image/x-portable-pixmap=gimp.desktop
application/x-war=file-roller.desktop
application/vnd.stardivision.impress=openoffice.org3-impress.desktop
image/svg+xml=shutter.desktop;gimp.desktop;
audio/x-flac=audacious2.desktop;gxine.desktop;kid3-qt.desktop;
application/vnd.sun.xml.base=openoffice.org3-base.desktop
audio/x-m4a=gxine.desktop
application/x-keepass=keepassx.desktop
application/vnd.oasis.opendocument.graphics-template=openoffice.org3-draw.desktop
application/x-doc=openoffice.org3-writer.desktop
application/keyhole=Google-googleearth.desktop
application/vnd.stardivision.draw=openoffice.org3-draw.desktop
application/rtf=openoffice.org3-writer.desktop
video/x-anim=gxine.desktop
application/xspf+xml=audacious2.desktop
application/x-7z-compressed=file-roller.desktop
audio/vnd.rn-realaudio=gxine.desktop
application/x-bzip=file-roller.desktop
audio/x-wavpack=kid3-qt.desktop
image/pcx=gimp.desktop
application/x-ear=file-roller.desktop
image/x-portable-anymap=gimp.desktop
application/x-ogg=audacious2.desktop;gxine.desktop;
application/vnd.openxmlformats-officedocument.presentationml.presentation=openoffice.org3-impress.desktop
application/x-rzip=file-roller.desktop
audio/x-mpegurl=audacious2.desktop;gxine.desktop;
application/x-ar=file-roller.desktop
audio/ogg=audacious2.desktop
application/vnd.ms-excel.sheet.binary.macroenabled.12=openoffice.org3-calc.desktop
application/x-gdesklets-display=gdesklets.desktop
image/x-ico=shutter.desktop
image/x-icon=gimp.desktop
audio/x-real-audio=gxine.desktop
audio/x-it=audacious2.desktop
application/vnd.ms-powerpoint.presentation.macroenabled.12=openoffice.org3-impress.desktop
application/x-bzip1=file-roller.desktop
application/x-alz=file-roller.desktop
application/msword=openoffice.org3-writer.desktop
image/x-portable-bitmap=gimp.desktop
application/vnd.ms-excel.template.macroenabled.12=openoffice.org3-calc.desktop
audio/x-pn-au=gxine.desktop
video/x-msvideo=gxine.desktop
application/x-flac=gxine.desktop
application/vnd.openxmlformats-officedocument.wordprocessingml.document=openoffice.org3-writer.desktop
application/vnd.google-earth.kmz=Google-googleearth.desktop
image/jpeg=shutter.desktop;gimp.desktop;
application/x-shockwave-flash=gxine.desktop
application/xhtml_xml=chromium-browser.desktop
application/x-zoo=file-roller.desktop
video/msvideo=gxine.desktop
text/plain=mousepad.desktop
application/vnd.oasis.opendocument.text=openoffice.org3-writer.desktop
video/x-ms-asf=gxine.desktop
application/x-jar=java-1.6.0-sun-java.desktop
image/x-xwindowdump=gimp.desktop
application/x-lzip-compressed-tar=file-roller.desktop
audio/x-mp3=audacious2.desktop;gxine.desktop;audacity.desktop;
application/mspowerpoint=openoffice.org3-impress.desktop
misc/ultravox=gxine.desktop
audio/mp4=kid3-qt.desktop
application/x-ms-dos-executable=wine.desktop;file-roller.desktop;
application/vnd.oasis.opendocument.spreadsheet-template=openoffice.org3-calc.desktop
image/x-png=shutter.desktop
image/xpm=shutter.desktop
application/vnd.sun.xml.writer=openoffice.org3-writer.desktop
video/quicktime=gxine.desktop
application/x-stuffit=file-roller.desktop
audio/mp3=audacious2.desktop
application/earthviewer=Google-googleearth.desktop
image/gif=shutter.desktop;gimp.desktop;
application/x-xz-compressed-tar=mount-archive.desktop;file-roller.desktop;
audio/basic=audacity.desktop
application/vnd.openxmlformats-officedocument.presentationml.template=openoffice.org3-impress.desktop
inode/directory=Thunar-folder-handler.desktop;kde4-filelight.desktop;kid3-qt.desktop;
text/html=firefox.desktop;chromium-browser.desktop;
application/vnd.stardivision.writer=openoffice.org3-writer.desktop
application/x-gzpostscript=file-roller.desktop
text/csv=openoffice.org3-calc.desktop
application/x-dbf=openoffice.org3-calc.desktop
image/g3fax=gimp.desktop
application/vnd.openxmlformats-officedocument.wordprocessingml.template=openoffice.org3-writer.desktop
audio/x-ms-asf=gxine.desktop
application/vnd.sun.xml.draw=openoffice.org3-draw.desktop
audio/x-pn-realaudio=gxine.desktop
application/x-ms-shortcut=wine.desktop
application/zip=mount-archive.desktop;file-roller.desktop;
x-directory/gnome-default-handler=Thunar-folder-handler.desktop
application/x-matroska=gxine.desktop
image/png=shutter.desktop;gimp.desktop;
application/vnd.stardivision.chart=openoffice.org3-calc.desktop
audio/x-mod=audacious2.desktop
application/vnd.oasis.opendocument.text-template=openoffice.org3-writer.desktop
application/vnd.ms-excel.sheet.macroenabled.12=openoffice.org3-calc.desktop
application/x-lzma=file-roller.desktop
image/tiff=shutter.desktop;gimp.desktop;
x-directory/normal=Thunar-folder-handler.desktop;kid3-qt.desktop;
application/vnd.ms-word.document.macroenabled.12=openoffice.org3-writer.desktop
application/pdf=epdfview.desktop;gimp.desktop;
application/wordperfect=openoffice.org3-writer.desktop
application/vnd.oasis.opendocument.presentation=openoffice.org3-impress.desktop
application/x-bittorrent=transmission-gtk.desktop
application/vnd.openxmlformats-officedocument.spreadsheetml.template=openoffice.org3-calc.desktop
audio/x-ms-asx=gxine.desktop
audio/x-ms-wax=gxine.desktop
application/vnd.stardivision.math=openoffice.org3-math.desktop
application/x-zip-compressed=file-roller.desktop
application/vnd.oasis.opendocument.formula=openoffice.org3-math.desktop
video/x-mpeg=gxine.desktop
application/x-cpio=mount-archive.desktop;file-roller.desktop;
audio/x-musepack=audacious2.desktop;kid3-qt.desktop;
image/vnd.rn-realpix=gxine.desktop
application/x-zip=mount-archive.desktop;file-roller.desktop;
audio/x-pn-wav=gxine.desktop
application/rdf+xml=firefox.desktop
application/x-compressed-tar=mount-archive.desktop;file-roller.desktop;
application/vnd.sun.xml.draw.template=openoffice.org3-draw.desktop
audio/x-pn-windows-acm=gxine.desktop
image/x-portable-graymap=gimp.desktop
application/msexcel=openoffice.org3-calc.desktop
application/x-gzip=file-roller.desktop
application/postscript=gimp.desktop
application/x-tar=mount-archive.desktop;file-roller.desktop;
image/x-xcf=gimp.desktop
audio/mpeg=audacious2.desktop;gxine.desktop;kid3-qt.desktop;audacity.desktop;
application/vnd.oasis.opendocument.text-master=openoffice.org3-writer.desktop
application/x-lrzip-compressed-tar=file-roller.desktop
image/x-xpixmap=gimp.desktop
application/vnd.stardivision.calc=openoffice.org3-calc.desktop
application/x-cbr=file-roller.desktop
application/vnd.ms-word.template.macroenabled.12=openoffice.org3-writer.desktop
application/x-gtar=file-roller.desktop
audio/x-speex=kid3-qt.desktop
application/vnd.sun.xml.writer.global=openoffice.org3-writer.desktop
image/x-bmp=shutter.desktop
application/x-compress=file-roller.desktop
application/x-cbz=file-roller.desktop
application/x-java-jnlp-file=java-1.6.0-sun-webstart.desktop
audio/x-scpls=audacious2.desktop;gxine.desktop;
text/calendar=xfcalendar.desktop
application/x-rar-compressed=file-roller.desktop
application/vnd.wordperfect=openoffice.org3-writer.desktop
application/x-iso=isomaster.desktop
audio/x-vorbis+ogg=audacious2.desktop;kid3-qt.desktop;
application/x-7z-compressed-tar=file-roller.desktop
application/vnd.sun.xml.calc.template=openoffice.org3-calc.desktop
audio/midi=audacious2.desktop
audio/x-stm=audacious2.desktop
audio/aac=kid3-qt.desktop
application/vnd.rn-realmedia=gxine.desktop
application/vnd.ms-powerpoint=openoffice.org3-impress.desktop
video/x-flc=gxine.desktop
application/xml=firefox.desktop
video/dv=gxine.desktop
application/vnd.oasis.opendocument.presentation-template=openoffice.org3-impress.desktop
image/x-fits=gimp.desktop
image/x-tga=shutter.desktop;gimp.desktop;
application/x-emerald-theme=emerald-theme-manager.desktop
application/x-lha=file-roller.desktop
application/x-deb=file-roller.desktop
image/bmp=shutter.desktop;gimp.desktop;
audio/prs.sid=audacious2.desktop
application/x-java-archive=file-roller.desktop
audio/x-tta=kid3-qt.desktop
image/x-xbitmap=gimp.desktop
application/vnd.oasis.opendocument.spreadsheet=openoffice.org3-calc.desktop
application/x-bzip1-compressed-tar=file-roller.desktop
audio/x-aiff=audacity.desktop
application/x-rpm=file-roller.desktop
application/vnd.oasis.opendocument.database=openoffice.org3-base.desktop
application/vnd.sun.xml.math=openoffice.org3-math.desktop
audio/x-flac+ogg=kid3-qt.desktop
application/x-cabinet=file-roller.desktop
application/vnd.sun.xml.writer.template=openoffice.org3-writer.desktop
application/x-lzma-compressed-tar=mount-archive.desktop;file-roller.desktop;
audio/x-oggflac=kid3-qt.desktop
application/x-lzop=file-roller.desktop
video/mpeg=gxine.desktop
video/x-avi=gxine.desktop
message/rfc822=mozilla-thunderbird.desktop
video/x-ms-wmv=gxine.desktop
application/x-lrzip=file-roller.desktop
application/x-lhz=file-roller.desktop
application/vnd.sun.xml.impress.template=openoffice.org3-impress.desktop
application/vnd.ms-excel=openoffice.org3-calc.desktop
audio/x-mpeg=audacious2.desktop;gxine.desktop;
audio/x-ms-wma=audacious2.desktop
text/rtf=openoffice.org3-writer.desktop
application/xhtml+xml=firefox.desktop
audio/mpegurl=audacious2.desktop
application/x-arj=file-roller.desktop
application/vnd.sun.xml.calc=openoffice.org3-calc.desktop
video/x-fli=gxine.desktop
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #5 on: December 12, 2010, 04:21:40 PM »
Hi,

Have you read the thread from which I gave you the link ? The first place where I had been seeking was in my home. If you haven't I suggest you would also look to ~/.local/share/applications : there is also a mimeinfo.cache file there.

It's astonishing that choosing the application while doing a right click on the file doesn't fix it. So you may have to look at the file in your home too.

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline bascule

  • Full Member
  • ***
  • Posts: 85
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #6 on: December 13, 2010, 12:47:40 PM »
Have you read the thread from which I gave you the link ?
Yes I have, and the user mimeinfo.cache just contains additional application entries for Wine...

It's astonishing that choosing the application while doing a right click on the file doesn't fix it. So you may have to look at the file in your home too.
That does work, but it assigns a MIME type to the application, not a file type. So, because my *.doc files are treated as text/plain, nothing I do with application defaults will fix it.

Sorry, I am obviously not making myself clear. The problem is with the mapping of file type (*.doc, *.txt etc.) to a MIME type. MIME type mappings to applications is working correctly.
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #7 on: December 13, 2010, 12:56:41 PM »
Have you read the thread from which I gave you the link ?
Yes I have, and the user mimeinfo.cache just contains additional application entries for Wine..

Sorry, I am obviously not making myself clear. The problem is with the mapping of file type (*.doc, *.txt etc.) to a MIME type. MIME type mappings to applications is working correctly.

Hi,

This might be due to WINE. Each time I install it (can't stand to keep it long but need it once a while) it messes the file association in some of my applications. ie: to open a documentation with "html" extension, now I get Geany ! the text editor. :-(

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline bascule

  • Full Member
  • ***
  • Posts: 85
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #8 on: December 13, 2010, 02:18:33 PM »
Fixed!

After Googling again (finding https://bbs.archlinux.org/viewtopic.php?id=60168), decided the problem was with the file /usr/share/mime/packages/kde.xml, which is one of the source files that the mime-info packages use to create the MIME mapping files.
It contains the lines:
  </mime-type>
  <mime-type type="text/plain"> <!-- As discussed on xdg list, *.doc is needed here for disambiguation -->
    <glob pattern="*.doc"/>
  </mime-type>

As root, changed filename to *.bak (as I'm not running KDE) and ran the MIME update program 'update-mime-database -V /usr/share/mime'. I could just have commented/deleted those lines from the file.

Following a restart, everything came good  ;D
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #9 on: December 13, 2010, 03:44:49 PM »
(as I'm not running KDE)

You are not ? What DE do you use ? :o
(How come do you have a kde.xml file ? Did you originally install a KDE version ?)


melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline bascule

  • Full Member
  • ***
  • Posts: 85
Re: Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #10 on: December 14, 2010, 03:06:16 AM »
(as I'm not running KDE)
You are not ? What DE do you use ? :o

As in my sig and the title of the thread and the forum board name, I'm running Xfce (PCLOS Phoenix)  ::)

(How come do you have a kde.xml file ? Did you originally install a KDE version ?)

I have no idea. Either Phoenix just comes with it, as PCLOS is, at heart, KDE-based, or it was installed as a dependency along with one of the many KDE apps I run on top of Xfce
Intel P4 2GHz, 768 MB RAM
GeForce4 Ti 4600
PCLOS Phoenix 2010, fully updated

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: [Solved] Xfce/Thunar has wrong MIME type for Word .doc files
« Reply #11 on: December 14, 2010, 07:57:13 AM »
Hi,

Then you could try to see if it belongs to one of your packages, by copying this command to your Terminal:
Code: [Select]
rpm -qf /usr/share/mime/packages/kde.xml-bak

or maybe you would need to switch it back to "kde.xml" temporarily, to make the command work. If it retuns that it doesn't belong to a package, then you know it was probably there before.

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode