unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: why not use unicode if html file has charset=utf-8?
Date: Tue, 27 Jul 2004 09:50:56 -0600	[thread overview]
Message-ID: <410679E0.8020802@yahoo.com> (raw)
In-Reply-To: mailman.1175.1090559914.1960.bug-gnu-emacs@gnu.org

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

       reply	other threads:[~2004-07-27 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1175.1090559914.1960.bug-gnu-emacs@gnu.org>
2004-07-27 15:50 ` Kevin Rodgers [this message]
2004-07-22 23:33 why not use unicode if html file has charset=utf-8? Dan Jacobson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410679E0.8020802@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).