9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Steve Simon" <steve@quintile.net>
To: 9fans@cse.psu.edu
Subject: [9fans] umlaut
Date: Wed,  2 Feb 2005 15:43:22 +0000	[thread overview]
Message-ID: <ba58fea577120a13ab8c9f5a6dd59018@quintile.net> (raw)

mail -s umlaut 9fans

Isn't the 'problem' that you are reading the rawunix headers
which don't honour the mime character set encoding, and then
processing them with sed which assumes its input is utf8?

There are many solutions to this, most are ugly (use ape's sed)
or a load of work (upas/fs to support a cookedunix file).
My prefered solution is to replace sed with a trivial c prog
in pipeto.lib:

/*
 * upas/padfrom - prevent upas/fs from miss interpreting
 * the work From in email messages
 */
#include <u.h>
#include <libc.h>
#include <bio.h>

main()
{
	char *p;
	Biobuf bi, bo;

	Binit(&bi, 0, OREAD);
	Binit(&bo, 1, OWRITE);

	while ((p = Brdline(&bi, '\n')) != nil && Blinelen(&bi) > 1)
		Bwrite(&bo, p, Blinelen(&bi));
	while ((p = Brdline(&bi, '\n')) != nil){
		if (strncmp(p, "From ", 5) == 0)
			Bputc(&bo, ' ');
		Bwrite(&bo, p, Blinelen(&bi));
	}
}



                 reply	other threads:[~2005-02-02 15:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=ba58fea577120a13ab8c9f5a6dd59018@quintile.net \
    --to=steve@quintile.net \
    --cc=9fans@cse.psu.edu \
    /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.
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 NNTP newsgroup(s).