WThreeMReportedProblems

Problems, questions and hopefully some answers too

Weird Characters

If you are seeing some Japanese characters or nothing at all where you expect Umlauts and other characters, customize the w3m group and change all the references of the ‘euc-jp’ coding system options to ‘latin-1’.

I’ve had a little better luck with making pages look right by putting the following into my ~/.emacs file:
    (setq w3m-coding-system 'utf-8
          w3m-file-coding-system 'utf-8
          w3m-file-name-coding-system 'utf-8
          w3m-input-coding-system 'utf-8
          w3m-output-coding-system 'utf-8
          w3m-terminal-coding-system 'utf-8)
Is there some reason this approach would be worse than using ‘latin-1’? – JerameyCrawford

You may want to store your w3m bookmark file coding system to ‘emacs-mule’ in order to be able to mix Japanese and Latin-1 names.

I am not sure whether you ever need to fiddle with the w3m charset coding system alist. When I last looked at it, it didn’t contain any entries for latin-1 pages.

Some pages contain the evil bullet character that displays as \225 and ought to be a little superscript plus sign. I think. In order to change that to a plus, add the following to your ~/.emacs file:

 (standard-display-ascii ?\225 [?+])

"\240" seen with emacs-w3m FreeBSD

First make sure your locale is set correctly. In my .bashrc I place this:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

then you will want to make sure you are using the port www/w3m-m17n-img. That should fix the problem

Filtering To Downcast To ASCII

emacs-w3m allows users to filter content, and this feature can be used to downcast entities, unicode, and other “?”-spawning characters into something of your choice in ASCII.

First, use standard-display-ascii where you can. I put this in my .emacs:

(standard-display-ascii ?\225 [?+])
(standard-display-ascii ?\227 [?-])
(standard-display-ascii ?\222 [?'])

Now, use w3m-filter-url to do everything else. Add this code to your .emacs-w3m.el:

(setq w3m-use-filter t)
;; send all pages through one filter
(setq w3m-filter-rules `(("\\`.+" w3m-filter-all)))

(defun w3m-filter-all (url)
  (let ((list '(
                ;; add more as you see fit!
               	("»" ">>")
               	("&laquo class="comment">;" "<")
                ("&raquo class="comment">;" ">")
                ("&ouml class="comment">;" "o")
                ("…" "...")
                ("‘" "'")
                ("’" "'")
                ("&rsquo class="comment">;" "'")
                ("&lsquo class="comment">;" "'")
                ("\u2019" "\'")
                ("\u2018" "\'")
                ("\u201c" "\"")
                ("\u201d" "\"")
                ("&rdquo class="comment">;" "\"")
                ("&ldquo class="comment">;" "\"")
                ("“" "\"")
                ("”" "\"")
                ("\u2013" "-")
               	("\u2014" "-")
                ("–" "-")
                ("—" "-")
                ("&ndash class="comment">;" "-")
                ("&mdash class="comment">;" "-")
                )))
  (while list
    (let ((pat (car (car list)))
          (rep (car (cdr (car list)))))
      (goto-char (point-min))
      (while (search-forward pat nil t)
        (replace-match rep))
      (setq list (cdr list))))))

So far this has helped rid my browser of “?” substitutions. Obviously there are many more I have not felt the need to add here (yet). I will edit this list over time as my needs demand.

- BradClawsie (May 2008)

Weird Characters on MS Windows

This may be a little too specific, but I was having some difficulty getting the <HR> tag to show correctly under emacs 21.3.50. I was seeing the nice graphic tables, but the HR line was unprintable, so I was just getting a series of open boxes.

I traced the problem to the w3m-symbol package, and hacked a modification to the w3m-mule-unicode-symbol table. I found out that by setting w3m-use-symbol to nil I could display using just ASCII, but the graphic characters looked so much better.

The problem was that the character used for HR was apparently not in this (or any) font that I had installed.

I just modified the symbol table to change the hr and second-level bullet character to other values that would print.

Here’s my .emacs settings. I’m no elisp coder, but I KNOW there’s a better way to do this. I would be very happy for suggestions on a more concise way to modify the unicode table.

 ;; to see the raw SYMBOL codes generated by emacs-w3m and track down
 ;; an errant character, set the following: You can use this code to
 ;; find which position in the symbol array is being used, and replace
 ;; that as needed
 ;(setq w3m-symbol '("" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""))
 ;; to undo and revert back to normal
 ;(setq w3m-symbol 'w3m-mule-unicode-symbol)
 ;When t, uses the symbol set specified in the variable
 ;w3m-symbol. This works using unicode to paint the tables and
 ;hr with graphic lines, given the patch to the variable
 ;w3m-mule-unicode-symbol below. If the font shows garbage, set to nil
 (setq w3m-use-symbol t)
 ;; overwrite the symbol table here. This is defined originally in
 ;; w3m-symbol, but changing it here rather than in the source code
 ;; allows me to update w3m and still keep the affected change
 ;; characters changed are (0-based array):
 ;; position 26 (<HR> character):   from (32 33) to (32 32)
 ;; position 33 (2d level indent):  from (33 97) to (115 34 mule-unicode-0100-24ff)
 (setq w3m-mule-unicode-symbol
   (when (w3m-mule-unicode-p)
     (append
      (mapcar (lambda (p)
        (if p
 	   (char-to-string
 	    (make-char (or (nth 2 p) 'mule-unicode-2500-33ff)
 		       (car p) (cadr p)))
 	 ""))
      '((32 92) (32 60) (32 76)  (32 44) (32 68) (32 34)  (32 48) nil
        (32 84) (32 52) (32 32)  nil     (32 56) nil      nil     nil
        (32 92) (32 64) (32 79)  (32 47) (32 72) (32 35)  (32 51) nil
 ;       (32 87) (32 55) (32 33)  nil     (32 59) nil      nil     nil
        (32 87) (32 55) (32 32)  nil     (32 59) nil      nil     nil
 ;       (115 34 mule-unicode-0100-24ff)  (33 97) (34 102) (34 43) (33 96) (34 101)
        (115 34 mule-unicode-0100-24ff)  (115 34 mule-unicode-0100-24ff) (34 102) (34 43) (33 96) (34 101)
        (34 46) (34 47) (33 115) (34 47) (34 43) (33 97)
        (34 47)))
     (list (format "%c %c %c "
 	   (make-char 'mule-unicode-0100-24ff 121 42)
 	   (make-char 'mule-unicode-0100-24ff 118 113)
 	   (make-char 'mule-unicode-0100-24ff 118 115))))))

ChrisMcMahan

Webpages are truncated on MacOSX

If webpages get truncated, one could try evaluating

 (if (string= system-type "darwin")
     (setq process-connection-type nil))

as suggested in <m21xvxs8e5.fsf@panix.com> to solve a similar eshell issue, if upgrading is not an option.

W3M hangs on MacOSX 10.5

If W3M keeps hanging, try this:

(add-to-list ‘w3m-command-environment ‘(“GC_NPROCS” . “1”))[1]