From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: cannot encode a buffer?? Date: Wed, 25 Jun 2003 16:52:34 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200306250752.QAA01036@etlken.m17n.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=ISO-2022-JP X-Trace: main.gmane.org 1056529073 13791 80.91.224.249 (25 Jun 2003 08:17:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 25 Jun 2003 08:17:53 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jun 25 10:17:47 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19V5EG-0002oD-00 for ; Wed, 25 Jun 2003 10:02:08 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19V5IB-000214-00 for ; Wed, 25 Jun 2003 10:06:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19V5C3-0000j5-KW for emacs-devel@quimby.gnus.org; Wed, 25 Jun 2003 03:59:51 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19V5Av-0008VX-K0 for emacs-devel@gnu.org; Wed, 25 Jun 2003 03:58:41 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19V5Am-0008OU-Hy for emacs-devel@gnu.org; Wed, 25 Jun 2003 03:58:34 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19V552-0006EV-Q7; Wed, 25 Jun 2003 03:52:37 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h5P7qYu05022; Wed, 25 Jun 2003 16:52:34 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h5P7qY922872; Wed, 25 Jun 2003 16:52:34 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id QAA01036; Wed, 25 Jun 2003 16:52:34 +0900 (JST) Original-To: sds@gnu.org In-reply-to: (message from Sam Steingold on 24 Jun 2003 15:17:47 -0400) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15231 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15231 In article , Sam Steingold writes: >> > I have a file which starts with >> > ";;; -*- coding: utf-8-unix -*-" >> > >> > when I try to save it, I get this: >> > >> > These default coding systems were tried to encode text >> > in the buffer `.bbdb': >> > utf-8-unix >> > However, each of them encountered these problematic characters: >> > utf-8-unix: 山 本 和 彦 >> >> Does it work after (utf-translate-cjk-mode 1)? > indeed it does. thanks. > I wonder what is going on here: why did Emacs insist on asking me about > the new coding system on every save and then gleefully accepted the > coding system in the file header? It seems that when Emacs at first read the file .bbdb, those Japanese characters didn't exist, but they were inserted in the buffer by yourself or automatically by some package in your Emacs session. Correct? If utf-translate-cjk-mode is not turned on, those characters can't be encoded by utf-8. If you force saving them by utf-8, the encoder generates a utf-8 byte sequence corresponding to U+FFFD for each of them. In this situation, when you modify the buffer and try to save it, Emacs again detects that those characters can't be handled by utf-8, thus ask you to select some other safe coding system. There's no mechanism to distinguish once saved characters from the newly inserted characters. --- Ken'ichi HANDA handa@m17n.org