9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] umlaut
@ 2005-02-02 15:43 Steve Simon
  0 siblings, 0 replies; only message in thread
From: Steve Simon @ 2005-02-02 15:43 UTC (permalink / raw)
  To: 9fans

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));
	}
}



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-02 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-02 15:43 [9fans] umlaut Steve Simon

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).