解决mplayer双击打开含中文名文件时的出错信息

因为realplay在hardy老core dump所以个mplayer+win32codec用来播放rmvb文件但是发现mplayer一个奇怪问题双击打开中文的rmvb文件,mplayer提示“failed to open file ****后面一个近似于乱码一些由%分隔字符串但是直接拖放文件到mplayer窗口正常播放而且如果右键编辑打开方式手动添加一个mplayer命令打开rmvb文件一切正常

几天为了解决这个问题煞费苦心……首先那个奇怪字符串意义。google加上咨询结果这些字符串是URL规范非ASCII字符一种转换(PHP的urlencode()函数可以完成这个工作相关资料RFC17382.2章节No corresponding graphic US-ASCII

接着找Gnome打开方式相关资料这里了解了Gnome打开方式每个MIME类型文件对应一个几个.desktop文件对比一下手动添加打开方式列表选择程序打开两种方式对应的.desktop文件异同发现系统默认的mplayer.desktop其中一行Exe=gmplayer %U手动添加打开方式对应内容Exe=gmplayer猜测就是这个%U参数导致双击打开文件

一顿Linux Desktop Entry Specification终于了解那个%U意义自动文件路径以URL方式编码传递程序本身

所以解决这个问题方法将/usr/share/applications/mplayer.desktopExe=gmplayer %U修改Exe=gmplayer %F

附Exe各种参数意义摘自这里

Code Description
%f A single file name, even if multiple files are selected. The system reading the desktop entry should recognize that the program in question cannot handle multiple file arguments, and it should should probably spawn and execute multiple copies of a program for each selected file if the program is not able to handle additional file arguments. If files are not on the local file system (i.e. are on HTTP or FTP locations), the files will be copied to the local file system and %f will be expanded to point at the temporary file. Used for programs that do not understand the URL syntax.
%F A list of files. Use for apps that can open several local files at once. Each file is passed as a separate argument to the executable program.
%u A single URL. Local files may either be passed as file: URLs or as file path.
%U A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path.
%d Deprecated.
%D Deprecated.
%n Deprecated.
%N Deprecated.
%i The Icon key of the desktop entry expanded as two arguments, first –icon and then the value of the Icon key. Should not expand to any arguments if the Icon key is empty or missing.
%c The translated name of the application as listed in the appropriate Name key in the desktop entry.
%k The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known.
%v Deprecated.
%m Deprecated.

P.S.顺便双击视频文件打开vlc无法自动加载字幕问题解决解决方法导致原因嗯嗯

如果你喜欢这篇日志的话,欢迎订阅我的RSS Feed!
本文来源于一阁Blog。版权所有,转载请确保已阅读该页面

0 Responses to “解决mplayer双击打开含中文名文件时的出错信息”


  1. No Comments
  1. 1 用thunar+xarchiver代替nautilus+fileroller at 一阁Blog

Leave a Reply

Quote selected text