Hebrew subject text in mutt

Hebrew subject text in mutt

Daniel Shahaf d.s at daniel.shahaf.name
Mon Jan 5 18:17:32 IST 2015


Alan Yaniger wrote on Mon, Jan 05, 2015 at 14:09:06 +0200:
> Hi Linux-IL members,
> 
> I'm using bidiv to read Hebrew in mutt.
> 
> It works ok with reading Hebrew messages, but not when reading the
> subject headers, which still show the Hebrew backwards.
> 

Personally, I set edit_headers=on, and when I want to "reverse" an RTL
subject or body I type 'g' to open it in $EDITOR, read it there, and
then discard the editor.  That's not a great solution but it works well
when the volume of RTL mail is low.

(more below)

> So I wrote the following script caled "bidi_index" to enable reading of Hebrew in the subjects:
> 
> echo $@ > /tmp/index.out && bidiv /tmp/index.out
> 
> and I added to .muttrc the following:
> 
> set index_format = "/home/alan/.mutt/bidi_index %D %-15.15L   %s (%Z) |"
> 
> (I tried piping the text directly to bidiv, but I got an error, so I write to a temp file, and I have my script read the temp file.)
> 
> Mutt shows the Hebrew properly, but it creates a new problem. The minimum length for the sender's name no longer works. My setting is for a minimum length of 15 chars, as in the index_format setting I quoted above, but if the name is less than 15 chars, mutt does not pad the rest of the 15 chars with blanks.
> 
> This problem doesn't exist if I don't pipe to my script.
> 
> Does anyone know how to fix with this problem, or does anyone have an alternative way of displaying Hebrew in mutt (which you've checked gets around this problem)?  
> 

Did you try changing
    echo $@
to
    echo "$@"?

The difference:

% sh -c 'echo $@' - 'foo     ' bar   
foo bar
% sh -c 'echo "$@"' - 'foo     ' bar 
foo      bar

That's still not robust — it breaks when $1 is -e or -n.  If that's a
concern, use printf(1) instead of echo.

Cheers,

Daniel

> I'm using Mutt 1.5.21 (2010-09-15) on a gnome-terminal in Ubuntu 12.04,
> with LC_ALL="en_US.utf8".



More information about the Linux-il mailing list