unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: Asian characters in email corrupts all successive emails
Date: Mon, 8 Dec 2003 13:41:45 +0900 (JST)	[thread overview]
Message-ID: <200312080441.NAA12929@etlken.m17n.org> (raw)
In-Reply-To: <xn6n0a8n0qt.fsf@txc.stpn.soft.net> (message from puneet on Thu,  04 Dec 2003 08:58:18 -0500)

In article <xn6n0a8n0qt.fsf@txc.stpn.soft.net>, puneet <puneet@computer.org> writes:

>       I am using a recent cvs build of emacs. I have
> attached a small file with this email, which is part of my
> procmail.log.

>       As you can see on the line 14 of the attached file,
> it is the procmail log for some spam with asian
> characters. The problem is that in emacs, I am seeing all
> the lines after line 14 corrupted. It is not so if I use
> any other text editor (I have tried vim/vi).

Actually the file is already corrupted.  As the line 14
doesn't end with an ESC sequence to designate ASCII, the
bytes in the next lines are still considered as the lastly
designated charset (a Japanese charset in this case).

It seems that procmail trancates subject lines just by bytes
without considering the encoding.

And perhaps vim/vi assume ASCII designation sequence at line
end even if a line doesn't end with it, and perhaps Emacs
should do the same thing.  I'll work on it.

>       When I open the file in emacs and save it in another
> file, the saved file differs from the opened file.

Emacs can't preserve the exact byte sequence of the original
file on saving when the file is decoded by iso-2022 based
coding system, especially when the file contains incorrect
escape sequences.  Have you tried vim/vi to save the file?
Do they preserve the original byte sequence?

>       When such an email is coming to my mail
> folder/spool, emacs fails to recognize all the emails
> after the particular mail in the mail folder. Actually I
> am using gnus/nnml and emacs is not recognizing/getting
> any email after the particular email from the spool.

I think it's a bug of gnus/nnml.  From your description, I
suspect that it decodes all mails at once instead of
decoding each message one by one.  But, I'm not a Gnus user.
Could someone confirm it?

Anyway, please try this command to fix such kind of
incorrect ESC sequence.  It reads a file name FILENAME, and
write the fixed one into FILENAME.new.

(defun fix-iso2022 (file)
  (interactive "fFile to recover: ")
  (with-temp-file (concat file ".new")
    (set-buffer-multibyte nil)
    (let ((coding-system-for-read 'raw-text))
      (insert-file-contents file)
      (while (re-search-forward "\e$(?[@-~]" nil t)
	(or (search-forward "\e(B" (line-end-position) 'move)
	    (insert "\e(B"))))))

---
Ken'ichi HANDA
handa@m17n.org

      reply	other threads:[~2003-12-08  4:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-04 13:58 Asian characters in email corrupts all successive emails puneet
2003-12-08  4:41 ` Kenichi Handa [this message]

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=200312080441.NAA12929@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /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).