[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
encoding problem with url library
From: |
Seweryn Kokot |
Subject: |
encoding problem with url library |
Date: |
Wed, 29 Oct 2008 21:07:18 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Hello,
I wrote a function which look up a word under point using
http://megaslownik.pl/slownik/angielsko_polski/137151,kludge website.
What the function does is to retrieve the html source and then some text
processing which removes redundant stuff.
I'm just wondering what is wrong with `url-insert-file-contents'
function, because using this function I get some encoding problems which
can be seen at the upper part of the screenshot. While using
w3m-retrieve is ok! To see the difference just comment or uncomment 9th
and 10th line of the function below.
Is it a bug in `url-insert-file-contents'?
emacs_compare.png
Description: PNG image
--8<---------------cut here---------------start------------->8---
(defun my-word-lookup-megaslownik ()
"Look up a word under point with megaslownik."
(interactive)
(let ((url-adres
(concat "http://megaslownik.pl/slownik/angielsko_polski/"
(thing-at-point 'word)))
(filename (make-temp-file "url" nil ".html")))
(with-temp-file filename
(url-insert-file-contents url-adres) ; 1. works but with encoding
problems
;;; (w3m-retrieve url-adres) ; 2. works ok
(goto-char (point-min))
(search-forward "<body>" nil t)
(forward-line 1)
(delete-region (point)
(progn
(search-forward "<div
id=\"content\">" nil t)
(beginning-of-line)
(point)))
(delete-region (progn
(search-forward "<div
id=\"content\">" nil t)
(forward-line 1)
(point))
(progn
(search-forward "<div id=\"word\">"
nil t)
(beginning-of-line)
(point)))
(delete-region (progn
(search-forward "<div
class=\"ikony\">" nil t)
(beginning-of-line)
(point))
(progn
(search-forward "<div id=\"word2\">"
nil t)
(beginning-of-line)
(point)))
(delete-region (progn
(search-forward "<div
class=\"clearing\">" nil t)
(beginning-of-line)
(point))
(progn
(search-forward "body>" nil t)
(forward-line -1)
(point))))
(w3m (concat "file://" filename))))
--8<---------------cut here---------------end--------------->8---
Thanks in advance,
Seweryn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- encoding problem with url library,
Seweryn Kokot <=