[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: opening local files with arbitrary extensions as HTML



Hi,

>>>>> In [emacs-w3m : No.09551] 
>>>>>	Katsumi Yamaoka <yamaoka@xxxxxxx> wrote:
> >>>>> In [emacs-w3m : No.09547] Shinichiro HIDA wrote:

> >>>>>> In [emacs-w3m : No.09546]
> >>>>>>	"Eduardo Ochs" <eduardoochs@xxxxxxxxx> wrote:

> >> what is the recommended way to force w3m to open a local file as HTML?
> >> Here's an example: the first call to w3m below works, but the second
> >> one treats the local file as plain text and does not invoke w3m to
> >> render it as HTML...

> >>  (let ((w3m-async-exec nil))
> >>    (w3m "file:///usr/share/doc/galeon-common/FAQ.html"))

> >>  (let ((w3m-async-exec nil))
> >>    (w3m "file:///usr/share/doc/apache2-doc/manual/howto/cgi.html.en"))

> > If your apache working, it might be better to access to
> > http://localhost/doc/apache2-doc/manual/howto/index.html.en

> > ;; On debian, I'm using this way.

> I use neither Debian nor Apache, but the problem is that we don't
> have a means to detect the content type of a local file other than
> checking a file name extension, isn't it?  If you have the version
> of the `file' command that returns a content type of a file
> regardless of a file name extension, i.e.,

> $ file /usr/share/doc/apache2-doc/manual/howto/cgi.html.en
> /usr/share/doc/apache2-doc/manual/howto/cgi.html.en: text/html

On my Debian Etch, `file' command return as follows;

shinichiro@mars:/usr/share/doc/apache2-doc/manual/howto$ file cgi.html.en
cgi.html.en: XML 1.0 document text
shinichiro@mars:/usr/share/doc/apache2-doc/manual/howto$ file -i cgi.html.en
cgi.html.en: 
shinichiro@mars:/usr/share/doc/apache2-doc/manual/howto$ file --mime cgi.html.en
cgi.html.en: 
shinichiro@mars:/usr/share/doc/apache2-doc/manual/howto$ file -i -k cgi.html.en
cgi.html.en: \012- text/xml\012- text/xml

Actualy, these documents are writen as XHTML 1.0.

Thank you.

-- 
  Shinichiro HIDA  shinichiro@xxxxxxxxxxxxx
  GPG fingerprint = 5F2D 1656 FFF6 F691 A51C  5E61 E416 D398 470C 1CE9