SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm running Slackware64 14.2 and using mail (mailx) as an email client from the command line. Occasionally, I get a message body of [Binary content], which generally means there is some non-ASCII character in the message somewhere. I can read the message find in a text editor with "offending" characters rendered with their correct accent-marks, etc.
Is there something I can set for mailx to go ahead and show these characters? Otherwise, it's a bit of a pain to have to save the message to a file and read it with an editor later.
The problem isn't that I can read the message at all. If I save the message to disk, then use an editor to open it, I can see the message just fine, including special characters. But, I want to be able to see the message body from within mailx when I'm reading messages interactively.
The problem isn't that I can read the message at all. If I save the message to disk, then use an editor to open it, I can see the message just fine, including special characters. But, I want to be able to see the message body from within mailx when I'm reading messages interactively.
Not sure about mailx read mode ... maybe mutt can handle your high-ASCII chars ?
Sorry.
-- kjh
p.s. Maybe if you export a different value for PAGER, it would work for you ?
man mailx # search for PAGER
Quote:
PAGER Pathname of the program to use in the more command or when crt variable is set.
The default paginator pg(1) or, in BSD compatibility mode, more(1) is used if
this option is not defined.
The less command displays high-ASCII as Hex-Codes for me using my ancient LESS variable:
OK, I've figured out a solution from the sender side. Some of the messages have control characters; codeset isn't the issue. The messages have BEL characters, carriage-returns, ESCape, etc. Before piping one type of message (sbopkg update output) into mail I do:
This sbopkg output has ESC sequences and CRs. I first translate the newlines to "@@" to preserve them, then deleted all control characters and translate the "@@" back to newlines.
This is to remove CRs, the copyright symbol (although that might actually be OK) and the BEL character. This is to cleanup the output of a todo script.
In the end, my problem was not the codeset but control characters that mailx chokes on.
kjhambrick, I tried setting PAGER to less, but it didn't work for me, even though when I use less on the actual text I'm going to email it does show the control characters as e.g. ^G, highlighted. Nevertheless, I still get the "[binary content]" message in mail. This fellow was able to get less working: https://unix.stackexchange.com/quest...-in-cron-mailx, but I was not. Perhaps I'm not specifying it correctly in .mailrc:
I was also having issues with the output with mailx attaching a .BIN file when I wanted the output to be in the body of the email.
I have been using "tr -d \r" to fix this issue, which worked on basically all scripts I was running, until one day even with this in place I was still getting a .BIN file.
So I simply ran the script and piped this to 'cat -vet', so script|cat -vet and this showed me what characters were in the mix. The \r in the tr command sorts out any ^M characters, but this time is was getting some ^G characters, which looking up the ascii character set (https://docstore.mik.ua/orelly/unix3...ut/appa_01.htm) the octal for this is 007. So to fix the output to my script to work with mailx I simply use: script | tr -d "\007\r" |mailx -s "Test" somebody@nowhere.com
So 'cat -vet' is your friend to assist you with what characters are in place for you to apply the necessary octal value to delete.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.