Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Truncated email subject when contains accented characters #9122

Open
bereldhuin opened this issue Aug 15, 2024 · 2 comments
Open

Bug: Truncated email subject when contains accented characters #9122

bereldhuin opened this issue Aug 15, 2024 · 2 comments
Labels
waiting for info Issues or pull requests that need further clarification from the author

Comments

@bereldhuin
Copy link

bereldhuin commented Aug 15, 2024

PHP Version

8.3

CodeIgniter4 Version

4.5.4

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

cli

Database

No response

What happened?

Setting an email with accented characters in subject (eg : french accent : éàè...) removes n characters at the end of the subjet (n = number of accented chars).

This does not occur in the body.

Steps to Reproduce

Send an email with accented char in the subject :

 $email = service('email');

$email->setFrom('toto@gmail.com', 'Fred');
$email->setTo('titi@gmail.com');

$email->setSubject('Email éé Test');
$email->setMessage('Testing the email class.');

$email->send();

Expected Output

Should send and email with the following subjet :
Email éé Test

But instead sends :

Email éé Te (missing 2 last chars)

Anything else?

Using php 8.3.9 under Alpine 1.20 docker container, and Gmail as SMTP.

@bereldhuin bereldhuin added the bug Verified issues on the current code behavior or pull requests that will fix them label Aug 15, 2024
@kenjis
Copy link
Member

kenjis commented Aug 21, 2024

Thank you for reporting.

But I cannot reproduce. The following test passes.

    public function testEmailSubjectWithAccentedCharacters(): void
    {
        $config = config('Email');
        $email  = new MockEmail($config);

        $email->setTo('foo@foo.com');
        $email->setFrom('bar@foo.com');
        $email->setSubject('Email éé Test');

        $this->assertTrue($email->send());
        $this->assertSame('Email éé Test', $email->archive['subject']);
    }

@kenjis kenjis added waiting for info Issues or pull requests that need further clarification from the author and removed bug Verified issues on the current code behavior or pull requests that will fix them labels Aug 21, 2024
@visserrobin
Copy link

visserrobin commented Sep 3, 2024

Tested with a live version of Codeigniter 4.5.2. No characters are truncated. Could it be a characterset issue in the Email config? I also tested iso-8859-1 and Windows1252. Windows-1252 produces gibberish but doesn't truncate the subject line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for info Issues or pull requests that need further clarification from the author
Projects
None yet
Development

No branches or pull requests

3 participants