On Thu, Jul 29, 2010 at 2:14 AM, Thamer Mahmoud
<thamer.mahmoud@gmail.com> wrote:
> (defun www-get-page-title (url)
> (let ((title))
> (with-current-buffer (url-retrieve-synchronously url)
> (goto-char (point-min))
> (re-search-forward "<title>\\([^<]*\\)</title>" nil t 1)
> (setq title (match-string 1))
> (goto-char (point-min))
> (re-search-forward "charset=\\([-0-9a-zA-Z]*\\)" nil t 1)
> (decode-coding-string title (intern (match-string 1))))))
Just did a test on a wikipedia page, and looks like
`decode-coding-string' doesn't handle upper-case charsets, like UTF-8,
only utf-8.
So the last line should be:
(decode-coding-string title (intern (downcase (match-string 1)))))))
--
Thamer