GNU bug report logs - #16225
24.3.50; [PATCH] eww: machinery to set character encoding.

Previous Next

Package: emacs;

Reported by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

Date: Mon, 23 Dec 2013 15:39:03 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.3.50

Fixed in version 25.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16225 in the body.
You can then email your comments to 16225 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Mon, 23 Dec 2013 15:39:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 23 Dec 2013 15:39:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;  [PATCH] eww: machinery to set character encoding.
Date: Tue, 24 Dec 2013 00:38:07 +0900
This report includes a patch to the bug. Please, review and install it
to the official tree if appreciated.

The user can't change encoding type. This patch is to fix it.

Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

        * net/eww.el (eww-character-encoding): Default value of encoding type.
          (eww-display-html,eww-display-raw): Change to enable to set
          encoding type.
          (eww-mode-map): New key map and easy-menu to set encoding type.
          (eww-set-character-encoding): New funtion to set encoding type.
        
---
 lisp/net/eww.el | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 89a7eb9..9353b6e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -129,6 +129,7 @@ See also `eww-form-checkbox-selected-symbol'."
 (defvar eww-home-url nil)
 (defvar eww-start-url nil)
 (defvar eww-contents-url nil)
+(defvar eww-character-encoding 'utf-8)
 
 (defvar eww-local-regex "localhost"
   "When this regex is found in the URL, it's not a keyword but an address.")
@@ -189,7 +190,7 @@ word(s) will be searched for via `eww-search-prefix'."
 		    (or (cdr (assq 'charset (cdr content-type)))
 			(eww-detect-charset (equal (car content-type)
 						   "text/html"))
-			"utf8"))))
+			"utf-8"))))
 	 (data-buffer (current-buffer)))
     (unwind-protect
 	(progn
@@ -243,9 +244,9 @@ word(s) will be searched for via `eww-search-prefix'."
 (defun eww-display-html (charset url &optional document point)
   (or (fboundp 'libxml-parse-html-region)
       (error "This function requires Emacs to be compiled with libxml2"))
-  (unless (eq charset 'utf8)
+  (unless (eq charset eww-character-encoding)
     (condition-case nil
-	(decode-coding-region (point) (point-max) charset)
+	(decode-coding-region (point) (point-max) eww-character-encoding)
       (coding-system-error nil)))
   (let ((document
 	 (or document
@@ -364,7 +365,12 @@ word(s) will be searched for via `eww-search-prefix'."
   (let ((data (buffer-substring (point) (point-max))))
     (eww-setup-buffer)
     (let ((inhibit-read-only t))
-      (insert data))
+      (insert data)
+      (unless (eq eww-character-encoding 'utf-8)
+	(encode-coding-region (point-min) (1+ (length data)) 'utf-8)
+	(condition-case nil
+	    (decode-coding-region (point-min) (1+ (length data)) eww-character-encoding)
+	  (coding-system-error nil))))
     (goto-char (point-min))))
 
 (defun eww-display-image ()
@@ -417,6 +423,7 @@ word(s) will be searched for via `eww-search-prefix'."
     (define-key map "C" 'url-cookie-list)
     (define-key map "v" 'eww-view-source)
     (define-key map "H" 'eww-list-histories)
+    (define-key map "E" 'eww-set-character-encoding)
 
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
@@ -439,7 +446,8 @@ word(s) will be searched for via `eww-search-prefix'."
 	["List histories" eww-list-histories t]
 	["Add bookmark" eww-add-bookmark t]
 	["List bookmarks" eww-list-bookmarks t]
-	["List cookies" url-cookie-list t]))
+	["List cookies" url-cookie-list t]
+	["Character Encoding" eww-set-character-encoding]))
     map))
 
 (defvar eww-tool-bar-map
@@ -1029,7 +1037,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
      ((and (url-target (url-generic-parse-url url))
 	   (eww-same-page-p url eww-current-url))
       (eww-save-history)
-      (eww-display-html 'utf8 url eww-current-dom))
+      (eww-display-html eww-character-encoding url eww-current-dom))
      (t
       (eww-browse-url url)))))
 
@@ -1080,6 +1088,19 @@ Differences in #targets are ignored."
 	(setq count (1+ count)))
       (expand-file-name file directory)))
 
+(defun eww-set-character-encoding (encode)
+  "Set character encoding."
+  (interactive "sSet Character Encoding (default utf-8): ")
+  (cond ((zerop (length encode))
+	 (setq eww-character-encoding 'utf-8)
+	 (message "The change will take effect next load."))
+	(t
+	 (if (not (coding-system-p (car (read-from-string encode))))
+	     (user-error "Invalid encodeing type.")
+	   (setq eww-character-encoding (car (read-from-string encode)))
+	   (message "The change will take effect next load.")
+	   ))))
+
 ;;; Bookmarks code
 
 (defvar eww-bookmarks nil)
-- 
1.8.3.1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Tue, 24 Dec 2013 08:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: 24.3.50;
 [PATCH] eww: machinery to set character encoding.
Date: Tue, 24 Dec 2013 08:52:51 +0100
Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:

> This report includes a patch to the bug. Please, review and install it
> to the official tree if appreciated.
>
> The user can't change encoding type. This patch is to fix it.

Allowing the user to alter the encoding seems like a good idea.
However, the implementation doesn't seem ideal.  The best way to handle
this would be to have the `E' command prompt for the charset, and then
re-render the page immediately without setting any global variables.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Wed, 25 Dec 2013 07:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>, 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: 24.3.50;
 [PATCH] eww: machinery to set character encoding.
Date: Wed, 25 Dec 2013 16:32:51 +0900
> However, the implementation doesn't seem ideal.  The best way to handle
> this would be to have the `E' command prompt for the charset, and then
> re-render the page immediately without setting any global variables.

Thank you Lars,

I fixed it. Can you please review again? I send the patch again.

Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

        * net/eww.el (eww-display-html,eww-display-raw): Change to
          enable to set encoding type.
          (eww-mode-map): New key map and easy-menu to set encoding type.
          (eww-set-character-encoding): New funtion to set encoding type.

---
 lisp/net/eww.el | 43 ++++++++++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 13 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 02c93a0..8fbf94d 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -172,7 +172,7 @@ word(s) will be searched for via `eww-search-prefix'."
 		    "/")
 	       (expand-file-name file))))
 
-(defun eww-render (status url &optional point)
+(defun eww-render (status url &optional point encode)
   (let ((redirect (plist-get status :redirect)))
     (when redirect
       (setq url redirect)))
@@ -192,7 +192,7 @@ word(s) will be searched for via `eww-search-prefix'."
 		    (or (cdr (assq 'charset (cdr content-type)))
 			(eww-detect-charset (equal (car content-type)
 						   "text/html"))
-			"utf8"))))
+			"utf-8"))))
 	 (data-buffer (current-buffer)))
     (unwind-protect
 	(progn
@@ -203,12 +203,12 @@ word(s) will be searched for via `eww-search-prefix'."
                                  (car content-type)))
             (eww-browse-with-external-browser url))
 	   ((equal (car content-type) "text/html")
-	    (eww-display-html charset url nil point))
+	    (eww-display-html charset url nil point encode))
 	   ((string-match-p "\\`image/" (car content-type))
 	    (eww-display-image)
 	    (eww-update-header-line-format))
 	   (t
-	    (eww-display-raw)
+	    (eww-display-raw encode)
 	    (eww-update-header-line-format)))
 	  (setq eww-current-url url
 		eww-history-position 0))
@@ -243,12 +243,12 @@ word(s) will be searched for via `eww-search-prefix'."
 (declare-function libxml-parse-html-region "xml.c"
 		  (start end &optional base-url))
 
-(defun eww-display-html (charset url &optional document point)
+(defun eww-display-html (charset url &optional document point encode)
   (or (fboundp 'libxml-parse-html-region)
       (error "This function requires Emacs to be compiled with libxml2"))
-  (unless (eq charset 'utf8)
+  (unless (eq charset encode)
     (condition-case nil
-	(decode-coding-region (point) (point-max) charset)
+	(decode-coding-region (point) (point-max) encode)
       (coding-system-error nil)))
   (let ((document
 	 (or document
@@ -363,11 +363,16 @@ word(s) will be searched for via `eww-search-prefix'."
 				  (list :background (car new-colors))
 				  t))))))
 
-(defun eww-display-raw ()
+(defun eww-display-raw (&optional encode)
   (let ((data (buffer-substring (point) (point-max))))
     (eww-setup-buffer)
     (let ((inhibit-read-only t))
-      (insert data))
+      (insert data)
+      (unless (eq encode 'utf-8)
+	(encode-coding-region (point-min) (1+ (length data)) 'utf-8)
+	(condition-case nil
+	    (decode-coding-region (point-min) (1+ (length data)) encode)
+	  (coding-system-error nil))))
     (goto-char (point-min))))
 
 (defun eww-display-image ()
@@ -420,6 +425,7 @@ word(s) will be searched for via `eww-search-prefix'."
     (define-key map "C" 'url-cookie-list)
     (define-key map "v" 'eww-view-source)
     (define-key map "H" 'eww-list-histories)
+    (define-key map "E" 'eww-set-character-encoding)
 
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
@@ -442,7 +448,8 @@ word(s) will be searched for via `eww-search-prefix'."
 	["List histories" eww-list-histories t]
 	["Add bookmark" eww-add-bookmark t]
 	["List bookmarks" eww-list-bookmarks t]
-	["List cookies" url-cookie-list t]))
+	["List cookies" url-cookie-list t]
+	["Character Encoding" eww-set-character-encoding]))
     map))
 
 (defvar eww-tool-bar-map
@@ -552,11 +559,11 @@ appears in a <link> or <a> tag."
 	(eww-browse-url (shr-expand-url best-url eww-current-url))
       (user-error "No `top' for this page"))))
 
-(defun eww-reload ()
+(defun eww-reload (&optional encode)
   "Reload the current page."
   (interactive)
   (url-retrieve eww-current-url 'eww-render
-		(list eww-current-url (point))))
+		(list eww-current-url (point) encode)))
 
 ;; Form support.
 
@@ -1032,7 +1039,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
      ((and (url-target (url-generic-parse-url url))
 	   (eww-same-page-p url eww-current-url))
       (eww-save-history)
-      (eww-display-html 'utf8 url eww-current-dom))
+      (eww-display-html 'utf-8 url eww-current-dom))
      (t
       (eww-browse-url url)))))
 
@@ -1083,6 +1090,16 @@ Differences in #targets are ignored."
 	(setq count (1+ count)))
       (expand-file-name file directory)))
 
+(defun eww-set-character-encoding (encode)
+  "Set character encoding."
+  (interactive "sSet Character Encoding (default utf-8): ")
+  (cond ((zerop (length encode))
+	 (eww-reload 'utf-8))
+	(t
+	 (if (not (coding-system-p (intern encode)))
+	     (user-error "Invalid encodeing type.")
+	   (eww-reload (intern encode))))))
+
 ;;; Bookmarks code
 
 (defvar eww-bookmarks nil)
-- 
1.8.3.1

Regards,

Kenjiro

larsi <at> gnus.org writes:

> Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:
>
>> This report includes a patch to the bug. Please, review and install it
>> to the official tree if appreciated.
>>
>> The user can't change encoding type. This patch is to fix it.
>
> Allowing the user to alter the encoding seems like a good idea.
> However, the implementation doesn't seem ideal.  The best way to handle
> this would be to have the `E' command prompt for the charset, and then
> re-render the page immediately without setting any global variables.





Added tag(s) pending. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Dec 2013 09:04:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Wed, 25 Dec 2013 09:05:02 GMT) Full text and rfc822 format available.

Message #16 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: 24.3.50;
 [PATCH] eww: machinery to set character encoding.
Date: Wed, 25 Dec 2013 09:58:16 +0100
Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:

> I fixed it. Can you please review again? I send the patch again.

Looks good. It's new functionality, though, so it'll have to wait until
the feature freeze is over to be installed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Mon, 10 Nov 2014 21:40:03 GMT) Full text and rfc822 format available.

Message #19 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: 24.3.50;
 [PATCH] eww: machinery to set character encoding.
Date: Mon, 10 Nov 2014 22:39:23 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:
>
>> I fixed it. Can you please review again? I send the patch again.
>
> Looks good. It's new functionality, though, so it'll have to wait until
> the feature freeze is over to be installed.

Sorry; I forgot to go through these pending patches before I started
fixing bugs that didn't have pending patches.

So this patch doesn't apply any longer.  Could you re-spin it and
resubmit?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Sat, 22 Nov 2014 17:26:01 GMT) Full text and rfc822 format available.

Message #22 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Nakayama Kenjiro <nakayamakenjiro <at> gmail.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: 24.3.50;
 [PATCH] eww: machinery to set character encoding.
Date: Sun, 23 Nov 2014 02:25:43 +0900
[Message part 1 (text/plain, inline)]
Sure.
I will resubmit this patch soon.

Regards,
Kenjiro

On Tue, Nov 11, 2014 at 6:39 AM, Lars Magne Ingebrigtsen <larsi <at> gnus.org>
wrote:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:
> >
> >> I fixed it. Can you please review again? I send the patch again.
> >
> > Looks good. It's new functionality, though, so it'll have to wait until
> > the feature freeze is over to be installed.
>
> Sorry; I forgot to go through these pending patches before I started
> fixing bugs that didn't have pending patches.
>
> So this patch doesn't apply any longer.  Could you re-spin it and
> resubmit?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>



-- 
Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
GPG Key fingerprint = ED8F 049D E67A 727D 9A44  8E25 F44B E208 C946 5EB9
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Sat, 22 Nov 2014 17:38:02 GMT) Full text and rfc822 format available.

Message #25 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>
To: 16225 <at> debbugs.gnu.org
Cc: larsi <at> gnus.org, Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>
Subject: [PATCH]eww: machinery to set character encoding
Date: Sun, 23 Nov 2014 02:36:27 +0900
This patch makes users possible to change the encoding on eww.

Signed-off-by: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>

        * net/eww.el (eww-display-html,eww-display-raw): Change to
          enable to set encoding type.
          (eww-mode-map): New key map and easy-menu to set encoding type.
          (eww-set-character-encoding): New funtion to set encoding type.

---
 lisp/net/eww.el | 41 +++++++++++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6746668..3c1621c 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -241,7 +241,7 @@ See the `eww-search-prefix' variable for the search engine used."
   (interactive "r")
   (eww (buffer-substring beg end)))
 
-(defun eww-render (status url &optional point buffer)
+(defun eww-render (status url &optional point buffer encode)
   (let ((redirect (plist-get status :redirect)))
     (when redirect
       (setq url redirect)))
@@ -255,7 +255,7 @@ See the `eww-search-prefix' variable for the search engine used."
 		    (or (cdr (assq 'charset (cdr content-type)))
 			(eww-detect-charset (equal (car content-type)
 						   "text/html"))
-			"utf8"))))
+			"utf-8"))))
 	 (data-buffer (current-buffer)))
     (unwind-protect
 	(progn
@@ -265,14 +265,14 @@ See the `eww-search-prefix' variable for the search engine used."
                                  (car content-type)))
             (eww-browse-with-external-browser url))
 	   ((equal (car content-type) "text/html")
-	    (eww-display-html charset url nil point buffer))
+	    (eww-display-html charset url nil point buffer encode))
 	   ((equal (car content-type) "application/pdf")
 	    (eww-display-pdf))
 	   ((string-match-p "\\`image/" (car content-type))
 	    (eww-display-image buffer)
 	    (eww-update-header-line-format))
 	   (t
-	    (eww-display-raw buffer)
+	    (eww-display-raw buffer encode)
 	    (eww-update-header-line-format)))
 	  (plist-put eww-data :url url)
 	  (setq eww-history-position 0)
@@ -308,7 +308,7 @@ See the `eww-search-prefix' variable for the search engine used."
 (declare-function libxml-parse-html-region "xml.c"
 		  (start end &optional base-url))
 
-(defun eww-display-html (charset url &optional document point buffer)
+(defun eww-display-html (charset url &optional document point buffer encode)
   (or (fboundp 'libxml-parse-html-region)
       (error "This function requires Emacs to be compiled with libxml2"))
   ;; There should be a better way to abort loading images
@@ -319,9 +319,9 @@ See the `eww-search-prefix' variable for the search engine used."
 	     (list
 	      'base (list (cons 'href url))
 	      (progn
-		(unless (eq charset 'utf-8)
+		(unless (eq charset encode)
 		  (condition-case nil
-		      (decode-coding-region (point) (point-max) charset)
+		      (decode-coding-region (point) (point-max) encode)
 		    (coding-system-error nil)))
 		(libxml-parse-html-region (point) (point-max))))))
 	(source (and (null document)
@@ -429,11 +429,16 @@ See the `eww-search-prefix' variable for the search engine used."
     (shr-generic cont)
     (shr-colorize-region start (point) fgcolor bgcolor)))
 
-(defun eww-display-raw (&optional buffer)
+(defun eww-display-raw (&optional buffer encode)
   (let ((data (buffer-substring (point) (point-max))))
     (eww-setup-buffer buffer)
     (let ((inhibit-read-only t))
-      (insert data))
+      (insert data)
+      (unless (eq encode 'utf-8)
+       (encode-coding-region (point-min) (1+ (length data)) 'utf-8)
+       (condition-case nil
+	   (decode-coding-region (point-min) (1+ (length data)) encode)
+	 (coding-system-error nil))))
     (goto-char (point-min))))
 
 (defun eww-display-image (&optional buffer)
@@ -567,6 +572,7 @@ the like."
     (define-key map "v" 'eww-view-source)
     (define-key map "R" 'eww-readable)
     (define-key map "H" 'eww-list-histories)
+    (define-key map "E" 'eww-set-character-encoding)
 
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
@@ -589,7 +595,8 @@ the like."
 	["List histories" eww-list-histories t]
 	["Add bookmark" eww-add-bookmark t]
 	["List bookmarks" eww-list-bookmarks t]
-	["List cookies" url-cookie-list t]))
+	["List cookies" url-cookie-list t]
+       ["Character Encoding" eww-set-character-encoding]))
     map))
 
 (defvar eww-tool-bar-map
@@ -700,12 +707,12 @@ appears in a <link> or <a> tag."
 	(eww-browse-url (shr-expand-url best-url (plist-get eww-data :url)))
       (user-error "No `top' for this page"))))
 
-(defun eww-reload ()
+(defun eww-reload (&optional encode)
   "Reload the current page."
   (interactive)
   (let ((url (plist-get eww-data :url)))
     (url-retrieve url 'eww-render
-		  (list url (point) (current-buffer)))))
+		  (list url (point) (current-buffer) encode))))
 
 ;; Form support.
 
@@ -1307,6 +1314,16 @@ Differences in #targets are ignored."
 	(setq count (1+ count)))
       (expand-file-name file directory)))
 
+(defun eww-set-character-encoding (encode)
+  "Set character encoding."
+  (interactive "sSet Character Encoding (default utf-8): ")
+  (cond ((zerop (length encode))
+	(eww-reload 'utf-8))
+       (t
+	(if (not (coding-system-p (intern encode)))
+	    (user-error "Invalid encodeing type.")
+	  (eww-reload (intern encode))))))
+
 ;;; Bookmarks code
 
 (defvar eww-bookmarks nil)
-- 
1.9.3





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Sun, 23 Nov 2014 15:32:02 GMT) Full text and rfc822 format available.

Message #28 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: [PATCH]eww: machinery to set character encoding
Date: Sun, 23 Nov 2014 16:31:03 +0100
Kenjiro Nakayama <nakayamakenjiro <at> gmail.com> writes:

> This patch makes users possible to change the encoding on eww.
>
> Signed-off-by: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>
>
>         * net/eww.el (eww-display-html,eww-display-raw): Change to
>           enable to set encoding type.
>           (eww-mode-map): New key map and easy-menu to set encoding type.
>           (eww-set-character-encoding): New funtion to set encoding type.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Nov 2014 15:32:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.1, send any further explanations to 16225 <at> debbugs.gnu.org and Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Nov 2014 15:32:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Sun, 23 Nov 2014 18:26:01 GMT) Full text and rfc822 format available.

Message #35 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Ivan Shmakov <ivan <at> siamics.net>
To: 16225 <at> debbugs.gnu.org, 16225-submitter <at> debbugs.gnu.org
Subject: Re: bug#16225: eww: machinery to set character encoding 
Date: Sun, 23 Nov 2014 18:24:53 +0000
>>>>> Kenjiro Nakayama <nakayamakenjiro <at> gmail.com> writes:

 > @@ -1307,6 +1314,16 @@ Differences in #targets are ignored."
 >  	(setq count (1+ count)))
 >        (expand-file-name file directory)))

 > +(defun eww-set-character-encoding (encode)
 > +  "Set character encoding."
 > +  (interactive "sSet Character Encoding (default utf-8): ")

	Could this please be changed to use read-coding-system, just
	like the rest of Emacs (say, universal-coding-system-argument)?

	TIA.

 > +  (cond ((zerop (length encode))
 > +	(eww-reload 'utf-8))
 > +       (t
 > +	(if (not (coding-system-p (intern encode)))
 > +	    (user-error "Invalid encodeing type.")
 > +	  (eww-reload (intern encode))))))
 > +
 >  ;;; Bookmarks code

 >  (defvar eww-bookmarks nil)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A




Message sent on to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
bug#16225. (Sun, 23 Nov 2014 18:26:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16225; Package emacs. (Mon, 24 Nov 2014 16:01:02 GMT) Full text and rfc822 format available.

Message #41 received at 16225 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Ivan Shmakov <ivan <at> siamics.net>
Cc: 16225 <at> debbugs.gnu.org
Subject: Re: bug#16225: eww: machinery to set character encoding
Date: Mon, 24 Nov 2014 16:59:59 +0100
Ivan Shmakov <ivan <at> siamics.net> writes:

> 	Could this please be changed to use read-coding-system, just
> 	like the rest of Emacs (say, universal-coding-system-argument)?

Fixed on trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 23 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 183 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.