This problem were driving me nuts for a couple of hours so I decided to post it here, to the benefit of others. Using the PHPMailer class to send mail to members from one of our sites I were writing a new function, but all of a sudden my mailing function refused to cooperate, and would return the error:
Language string failed to load: instantiate
This mysterious error came out of the blue, since I’d been using the same function for a long time without any hassle. After going through every bit of the problem it boiled down to not having anything to do with any Language string, which one would believe, but the interesting part of the error message is instantiate.
It turned out that I was sending a subject header encoded as UTF-8, which the PHPMailer class would reject since it contained a perculiar swedish letter, namely “å”. Other swedish letters like “ä” and “ö” will work just fine encoded as UTF-8. But not “å”.
The solution? Simple enough, as always:
$subject = utf8_decode("Någon har svarat på din fråga på $site");
This converts the string to ISO-8859-1 encoding, which, of course, worked fine.
Popularity: 9% [?]
Thank you very much, I’ve been using PHPMailer for years, and suddenly had this happen to me and didn’t know what was going on.
Verrrrrrrrrrrrrrry goooooooodddddddd you save my life
Hey! Thanks a lot for sharing this knowledge. Quite helpful