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

Style lost in HTML email #4510

Closed
rcubetrac opened this issue Apr 8, 2014 · 6 comments
Closed

Style lost in HTML email #4510

rcubetrac opened this issue Apr 8, 2014 · 6 comments

Comments

@rcubetrac
Copy link

Reported by joydev on 8 Apr 2014 09:07 UTC as Trac ticket #1489777

Example content:

<b><span =
style=3D'font-family:"=E6=96=B0=E7=B4=B0=E6=98=8E=E9=AB=94","serif";color=
:red'>=E4=BB=A4=E5=85=A8=E5=A0=B4=E7=88=86=E6=BB=BF<span =
lang=3DEN-US>!</span></span></b>

Correct decoded text:

<b><span style='font-family:"","serif";color:red'><span lang=EN-US>!</span></span></b>

Result in roundcube (copied from chrome dev tools):

<b><span style="font-family: &quot;; color: red;"><span lang="EN-US">!</span></span></b>

The color is not changed because of the wrong syntax.
Tested v1.0-beta only.
Email sent using Outlook, with Word as editor (HTML).

Migrated-From: http://trac.roundcube.net/ticket/1489777

@rcubetrac
Copy link
Author

Milestone changed by @alecpl on 8 Apr 2014 09:55 UTC

later => 1.0.1

@rcubetrac
Copy link
Author

Comment by @alecpl on 8 Apr 2014 10:29 UTC

The problem is with unicode characters here. I added unit test in 5e3ee84

@rcubetrac
Copy link
Author

Comment by joydev on 11 Apr 2014 02:46 UTC

Test result:

# php phpunit.phar --bootstrap roundcubemail-master/tests/bootstrap.php roundcubemail-master/tests/Framework/Washtml.php
PHPUnit 4.0.14 by Sebastian Bergmann.

.......F

Time: 27 ms, Memory: 11.50Mb

There was 1 failure:

1) Framework_Washtml::test_style_unicode
Unicode chars in style attribute (#1489697)
Failed asserting that '<!-- html ignored --><!-- head ignored --><!-- meta ignored --><!-- body ignored --><span style='font-family: "; color: red;'></span>' matches PCRE pattern "|style='font-family: "","serif"; color: red'|".

roundcubemail-master/tests/Framework/Washtml.php:152

FAILURES!
Tests: 8, Assertions: 17, Failures: 1.

@rcubetrac
Copy link
Author

Comment by joydev on 11 Apr 2014 04:58 UTC

A quick fix for matching CJK unicode font names:

/-+/iu

This can match the samples I used: ""(Traditional Chinese),""(Simplified Chinese),""(Japanese),""(Korean)

If you want you may add additional check to only match the above if the style is font or font-family.

Reference: http://jrgraphix.net/research/unicode_blocks.php

@rcubetrac
Copy link
Author

Comment by @alecpl on 11 Apr 2014 07:19 UTC

Fixed in f96fec6.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 11 Apr 2014 07:19 UTC

new => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant