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

Integrate https://github.com/christiaan/InlineStyle #7

Closed
wants to merge 2 commits into from

Conversation

bwl21
Copy link

@bwl21 bwl21 commented Nov 26, 2015

Hi,

as I had trouble to get premailer working safely, I have integrated https://github.com/christiaan/InlineStyle. It seems to work properly with mosaico, but this needs to be verified.

It also solves the issues in #6.

On the first hand I made it configurable, which inliner to be used.

I also updated Readme.md to make it a bit more clear for beginners (as I am ).

I furtheron ignore some generated files and folders.

Updated readme.md accordingly.
Ignore generated files in this repository.
@mherbold
Copy link
Contributor

Awesome! I will look at this next week and integrate your changes with my main branch.

@bwl21
Copy link
Author

bwl21 commented Nov 26, 2015

Marvin, I have trouble if the template or the content of the email contains UTF-8 characters such as umlauts (öäüß). see voidlabs/mosaico#56. When I invoke downlaod and try to debug dl/index.php, the i can see that the $html variable is not in UTF-8. This makes InlineStyle fail.

Could you try if you have the same issue.

@bago
Copy link

bago commented Nov 26, 2015

PHP is not good at working with UTF-8....
In our proprietary code we have plenty of iconv conversions around, for example:

$encoding = $config->get("edit.encoding", "utf-8");
if ($encoding != "utf-8") $content = iconv($encoding, "utf-8", $content);

or, in our inliner we use Sabberworm parser, that have a lot of weird code to correctly parse non-ascii chars:
https://github.com/sabberworm/PHP-CSS-Parser/blob/master/lib/Sabberworm/CSS/Parser.php#L221

What does it happen if you REMOVE the inliner? Do the php backend "break" the encoding when "alone" or you isolated the encoding issue in the inliner?

@bwl21 bwl21 mentioned this pull request Nov 27, 2015
@bwl21
Copy link
Author

bwl21 commented Nov 27, 2015

@bago: I agree, that PHP is not good at working with UTF-8. (To be honest: I consider PHP as really bad, but am very impressed that people manage to implement Typo3, Wordpress and Moodle with it).

Nevertheless:

  • no meta, no inliner: special characters are broken in generated email
  • no meta, with inliner: as inliner crashes, no email is generated
  • meta, no inliner: special characters appear properly in generated email - but no inline styles
  • meta, with inliner: special characters appear properly in generated email - and we have inline styles

@bwl21
Copy link
Author

bwl21 commented Dec 9, 2015

I close this PR. It was not considered by ainterpreting and is now out of date.

@bwl21 bwl21 closed this Dec 9, 2015
@NJseo
Copy link

NJseo commented Mar 15, 2016

Well after integrating Mosaico, I too have come to the problems with Premailer. Was this a good solution to integrate this inliner, or do you recommend something else?

@bwl21
Copy link
Author

bwl21 commented Mar 15, 2016

@NJseo

John, please have a look on #13. The inliner works very well there.

But you need to ensure that the result of mosaico is wellformed xml. That means, that for example parameters in url - links are already encoded as entities.

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.

4 participants