UTF8 encoding & Bash

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Thu Jul 30 01:48:53 UTC 2009


Hi all,

   I've got a problem that I *thought* was perl, but turns out to be 
more fundamental. I switched to bash and the problem remains...

   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.

   For example;

-----------------------------------------------
#!/bin/bash

echo "### Start 右 ###"
/usr/bin/fantasdic -o Japanese 右

echo "### Start 林 ###"
/usr/bin/fantasdic -o Japanese 林
-----------------------------------------------

   Run this (as a script or as individual commands) and the output is 
clearly there and complete.

   However, if you redirect the output to a file, the first character 
will write out to the file where the second one will not. Actually, most 
of the output from the first character will write... it seems to 
double-encode at one point and bail, but I digress as I suspect solving 
the second command's problem will solve the first. :)

   Any idea what's going on here?

Madi
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list