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

Fix ISO-2022-JP-MS encoding convert #7091

Merged
merged 3 commits into from Jun 13, 2020
Merged

Conversation

shirosaki
Copy link
Contributor

ISO-2022-JP-MS characters are removed by iconv on sending mail.
Use mbstring functions on sending.
A message with ISO-2022-JP-MS characters currupts by wordwrap.
Use ISO-2022-JP-MS charset in wordwrap.

@alecpl
Copy link
Member

alecpl commented Dec 2, 2019

Is it a PHP bug? Could you provide some samples/steps to reproduce the issue? Create some unit tests?

@shirosaki
Copy link
Contributor Author

This is not a PHP bug.
Japanese OS environment would be required to reproduce this issue.

Related to this issue.
#5668

Use this plugin.
https://github.com/joniburn/sendcharset/blob/master/sendcharset.php

Change send charset to ISO-2022-JP.

If I send a message with subject, body or to/cc address name that contain Japanese characters including ISO-2022-JP-MS characters like '①②③', Japanese characters are removed or corrupted.

I'll try to add unit tests.

ISO-2022-JP-MS characters are removed by iconv on sending mail.
Use mbstring functions on sending.
Add a unit test.
A message with ISO-2022-JP-MS characters currupts by wordwrap.
Use ISO-2022-JP-MS charset in wordwrap.
Add a unit test.
Convert to UTF-8 to split addresses correctly.
Base64 encode ISO-2022-JP name.
Add a unit test.
@shirosaki
Copy link
Contributor Author

I've split patches and add a test for each change.

mb_internal_encoding($mb_charset);
$name = preg_replace('/^"(.*)"$/', '$1', $name);
$name = mb_encode_mimeheader($name, $mb_charset, $head_encoding_mode, "\r\n", 8);
mb_internal_encoding(RCUBE_CHARSET);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part could be replaced by Mail_mimePart::encodeMB() if
pear/Mail_Mime#18 was accepted.

@alecpl
Copy link
Member

alecpl commented Dec 4, 2019

Whay don't you just set the sendcharset to ISO-2022-JP-MS?

@shirosaki
Copy link
Contributor Author

shirosaki commented Dec 4, 2019 via email

@shirosaki
Copy link
Contributor Author

@alecpl We have upgraded our roundcube to 1.4 with the patches. It works fine.
Other mailers and web mail services support this. So same behavior is expected in Japan.

This company seems to fix some Japanese encoding problems for enterprise support.
https://www.designet.co.jp/system/support/maintenance/roundcube.html

@sanmai
Copy link

sanmai commented Jan 31, 2020

See my comment here.

@shirosaki Am I passing your point along all right?

@shirosaki
Copy link
Contributor Author

@sanmai You are right.
We have to use iso-2022-jp-ms for iso-2022-jp variant characters.

@alecpl alecpl added this to the 1.5-beta milestone Jun 13, 2020
@alecpl alecpl merged commit 30610e8 into roundcube:master Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants