-2

We have a bash script that sends mail of reports generated . These reports are present in various languages, and currently we have a problem of reports generated in polish language. The reports are getting delivered alright, but are in the CZECH language.

Here is the script : -

#!/bin/bash
export sendmail="/usr/lib/sendmail"
export subject="polish words"
{
 echo "To : recipient"
 echo Subject: $subject
 echo "Content-Type: text/plain; charset=Windows-1250"
 cat polish-report
 echo ""
 echo ""
} | sendmail -t

The windows-1250 Codepage previously differentiated clearly between Polish and czech while sending them through sendmail. But something seems to have changed and we receive polish reports in the czech language. (unintentionally translated)

The locale setting is that of UTF-8 and so is the remote character-set in putty (translation).

POLISH REPORT THAT COMES IN CZECH

Dodavatel: IMPULS Sp. z o.o. Datum požadavku: Datum potřeby: Žadatel: Zadal: popielh Důvod: niestandardowe zamáwienie Poznámka

WHAT IT WOULD LOOK LIKE IN POLISH

Dostawca impulsów Sp. z o.o. Data wniosku: Data potrzebne: Wnioskodawca: Przypisany: popielh Powód: niestandardowe zamáwienie Uwaga

Kindly help in finding out this translation happens from Polish to CZECH.

Regards

  • 1
    What do you mean "delivered in Czech language"? Are they simply in Polish, but have Czech characters inserted randomly? Can you provide an example, or are they confidential? – Karol S Aug 08 '14 at 16:45
  • we support sites of different languages, but for sites using czech and polish the common codepage is 1250. am not a native speaker of this language, but i was told the report was supposed to be polish but ended up in users mail in czech. below is an example. Dodavatel: IMPULS Sp. z o.o. Datum požadavku: Datum potřeby: Žadatel: Zadal: popielh Důvod: niestandardowe zamáwienie Poznámka The above is in czech. It should be in polish But i would like to understand where transalation is happening in script. Thank you. – user3922586 Aug 09 '14 at 14:29
  • None if this makes any sense. Whatever creates the file `polish-report` is doing it wrong. This script is not at fault for the problem you describe. – tripleee Aug 09 '14 at 14:36
  • the file polish-report is generated by an ERP in used. the script merely sends the mail. I pasted the characters of the polish report (getting delivered in czech language for some reason). and what it ideally must look like. I edited my post to carry more detail. Apologies. – user3922586 Aug 09 '14 at 14:53
  • Agreed, this problem has absolutely nothing to do with encodings. In fact, the Czech samples clearly show the encodings work correctly. – Karol S Aug 10 '14 at 22:01

1 Answers1

-1

Generate FULL set of mime headers - email readers may or may not ignore charset declaration in incomplete mime headers.

Mime-Version: 1.0
Content-Type: text/plain; charset=Windows-1250
Content-Transfer-Encoding: 8bit

BTW fix your script to generate empty line between header and body

AnFi
  • 10,493
  • 3
  • 23
  • 47
  • I will try these . But could you give me a brief idea about what exactly MIME and content-transfer-encoding does? and how would it help in this case? – user3922586 Aug 09 '14 at 14:33
  • It won't. But technically, your message is incomplete without the `MIME-Version:` header; and the default `Content-Transfer-Encoding` is `7bit`, which is incompatible with the 8-bit data you are sending. But again, this will not solve your language problem. – tripleee Aug 09 '14 at 14:40