FN11 sendmail utf-8 characters

Status
Not open for further replies.

Grewterd

Dabbler
Joined
Nov 30, 2015
Messages
31
My SMART status script which was modified from the script I found here is no longer sending the degree character correctly after upgrading to FN11 from 9.10. The issue appears to be with either python or sendmail, this is the error I am getting:

Code:
Traceback (most recent call last):
  File "/etc/find_alias_for_smtplib.py", line 128, in
  main()
  File "/etc/find_alias_for_smtplib.py", line 123, in main
  msg = sys.stdin.read()
  File "/usr/local/lib/python3.6/codecs.py", line 321, in decode
  (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 503: invalid start byte

When I echo or printf \xB0 the character is displayed on the command line correctly. The file that is created displays the character.
It seems to fail when sendmail is invoked to send the email.

Bash code that creates the header:

Code:
C=$'\xB0'C
F=$'\xB0'F

###### summary ######
(
  echo ""
  echo "########## SMART status report summary for all drives ##########"
  echo ""
  echo "+------+---------------+----+-----+------+-----+-----+-------+-------+--------+------+------+------+--------------+----+------+"
  echo "|Device|Serial  |Temp|Temp |Power |Start|Spin |ReAlloc|Current|Offline |UDMA  |Seek  |High  |Command  |Last|Test  |"
  echo "|ID  |Number  | $C | $F  |On  |Stop |Retry|Sectors|Pending|Uncorrec|CRC  |Errors|Fly  |Timeout  |Test|Result|"
  echo "|  |  |  |  |Hours |Count|Count|  |Sectors|Sectors |Errors|  |Writes|Count  |Age |  |"
  echo "+------+---------------+----+-----+------+-----+-----+-------+-------+--------+------+------+------+--------------+----+------+"
)  >> "$logfile"

Example output of the header of my report:

Code:
+------+---------------+----+-----+------+-----+-----+-------+-------+--------+------+------+------+--------------+----+------+
|Device|Serial  |Temp|Temp |Power |Start|Spin |ReAlloc|Current|Offline |UDMA  |Seek  |High  |Command  |Last|Test  |
|ID  |Number  | °C | °F  |On  |Stop |Retry|Sectors|Pending|Uncorrec|CRC  |Errors|Fly  |Timeout  |Test|Result|
|  |  |  |  |Hours |Count|Count|  |Sectors|Sectors |Errors|  |Writes|Count  |Age |  |
+------+---------------+----+-----+------+-----+-----+-------+-------+--------+------+------+------+--------------+----+------+


The sendmail command:

Code:
sendmail -t < "$logfile"

I'm not sure if there is a better way to do this in my script, if I'm using sendmail wrong or if this is a bug and I should report it. I'd appreciate any advice.
 
D

dlavigne

Guest
It might be a bug. Please create a report at bugs.freenas.org and post the issue number here.
 
Status
Not open for further replies.
Top