Using UTF-8 characters on an e-mail title for user validation email

Hello,

I translate English file in (/mod/uservalidationbyemail/language/en.php) to my language (with UTF-8 characters). when user try to register on my Elgg website, validation email not send, or send with strange character on title.

when I change the Line 5 of language file, this problem happened:

Line 5 ==> ('email:validate:subject' => "%s please confirm your email address for %s!",)

how can I use UTF-8 character in validation email title without Error?

 

  • Stricly speaking, only ASCII characters are allowed in email headers. And the subject line is part of the email header. It seems that it's possible to add support for UTF characters in subject line (Google gives results that explain how to do it in general). For Elgg it might work to do modifications in elgg_send_email() function in Elgg core. But I won't try this myself as I don't think it's wise to do stuff against the email standards. While you might be able to modify the sending of mails on your server to support UTF characters you can say for sure what email servers receiving these emails and email clients of users will do with these characters. Some might work without issues and others might not.

    Also, it's wrong to modify en.php for adding translations. The en.php files are for the English language output. If you want to add translations, add a language file with the corresponding language code name, e.g. de.php for German or fr.php for French etc. At the end of the main language file you will see a list of language codes supported by Elgg. Just name your files accordingly.

    You also shouldn't add your modifications to the original language files as you risk to lose your changes every time you update Elgg. Instead of modifying the Elgg core files add your changed / additional language strings in a separate plugin. You can take a look at https://elgg.org/plugins/1497293 as an example for such a plugin. This plugin gives you the necessary basic structure of a plugin necessary and you can simply add / remove additional language string in en.php for the English language and/or add/remove additional language files for and other language.

  • Also, it's wrong to modify en.php for adding translations. The en.php files are for the English language output. If you want to add translations, add a language file with the corresponding language code name, e.g. de.php for German or fr.php for French etc. At the end of the main language file you will see a list of language codes supported by Elgg. Just name your files accordingly.

    I know, I don't change original file, I copy-paste en.php and rename it to my language file, sorry for my bad English.

    Thanks to you for answering.