UTF8 encoding & Bash

D. Hugh Redelmeier hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Thu Jul 30 03:00:31 UTC 2009


| From: Madison Kelly <linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org>

|   There is a program called 'fantasdic' which takes a Japanese character and
| returns information on it. When it outputs to STDOUT it's fine, but when the
| output is redirected to a file, 0 bytes are written. This only happens with
| certain characters, no less.

stdio, for example, buffers more if the output device is not a tty.

If the program crashes or exits rudely, the buffers might not get
flushed.

Buffering on a pipe might be less than on a file (I don't remember).
Try
	/usr/bin/fantasdic -o Japanese 右 | cat >destfile


Try
	/usr/bin/fantasdic -o Japanese 右 ; echo "return code $?" >&2
That might show if the exit was bad.

You can always use strace.


More information about the Legacy mailing list