php-sparkpost icon indicating copy to clipboard operation
php-sparkpost copied to clipboard

ISO8859-1 characters in subject

Open dturriaga opened this issue 3 years ago • 0 comments

I read that only are supported UTF8 characters without RFC 2047...

How can I write in the subject words with vowels with tíldes and ñ?

All the sources of the project are in ISO8859-1, so when preparing the email I do:

	...
	$httpClient = new GuzzleAdapter(new Client());
	$sparky = new SparkPost($httpClient, ['key'=>"1234567890abcdef1234567890abcdef12345678"]);
	$promise = $sparky->transmissions->post([
	    'content' => [
			'from' => ['name' => $from_name, 'email' => $from_email],
			'subject' => utf8_encode($subject),
			'html' => utf8_encode($html),
			'text' => '{{user}}: html not supported',
	    ],
	    'substitution_data' => ['user' => $user],
	    'recipients' => [
	        [
	            'address' => ['name' => $user, 'email' => $email],
	        ],
	    ],
	]);

but latin1 characters in then subject display wrong and, if I dont use utf8_encode on subject, I have an exception.

dturriaga avatar Nov 12 '21 20:11 dturriaga