all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* why not use unicode if html file has charset=utf-8?
@ 2004-07-22 23:33 Dan Jacobson
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Jacobson @ 2004-07-22 23:33 UTC (permalink / raw)


One would think that if some file.html had
<META http-equiv=Content-Type content="text/html; charset=utf-8">
near the top, emacs would show it with the unicode charset.
Browsers get that right.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: why not use unicode if html file has charset=utf-8?
       [not found] <mailman.1175.1090559914.1960.bug-gnu-emacs@gnu.org>
@ 2004-07-27 15:50 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2004-07-27 15:50 UTC (permalink / raw)


Dan Jacobson wrote:
 > One would think that if some file.html had
 > <META http-equiv=Content-Type content="text/html; charset=utf-8">
 > near the top, emacs would show it with the unicode charset.
 > Browsers get that right.

I think the first step would be to go from the (MIME) charset attribute
value to an Emacs coding system.  But this particular example (utf-8)
returns 8 alternatives on Emacs 21.3:

(let ((mime-charset 'utf-8)	; more generally: (intern (downcase "UTF-8"))
       (coding-systems '()))
   (mapatoms (lambda (symbol)
               (if (and symbol
                        (coding-system-p symbol)
                        (eq (coding-system-get symbol 'mime-charset)
                            mime-charset))
                   (setq coding-systems (cons symbol coding-systems)))))
   (sort coding-systems 'string-lessp)) =>
(mule-utf-8 mule-utf-8-dos mule-utf-8-mac mule-utf-8-unix utf-8 utf-8-dos utf-8-mac utf-8-unix)

What's the right way to choose among them?  Ah, gnus/mm-util.el has
ths: (mm-charset-to-coding-system "UTF-8") => utf-8

The next step would be to call set-buffer-file-coding-system; should
that be done via html-mode-hook, or is that too late?  What about using
after-insert-file-functions/after-insert-file-set-buffer-file-coding-system?

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-27 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-22 23:33 why not use unicode if html file has charset=utf-8? Dan Jacobson
     [not found] <mailman.1175.1090559914.1960.bug-gnu-emacs@gnu.org>
2004-07-27 15:50 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.