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

Incorrect characters #432

Open
kishorech0817 opened this issue Sep 21, 2023 · 5 comments
Open

Incorrect characters #432

kishorech0817 opened this issue Sep 21, 2023 · 5 comments

Comments

@kishorech0817
Copy link

kishorech0817 commented Sep 21, 2023

Recently, I observed my text has incorrect characters after using the Premailer with adapter adapter::nokogiri_fast.
Issue:

body = "<div dir=\"auto\">Wow … I got paid this morning I will b over I’m so so sorry gotta get a new lock that lock has been giving me nothing but problems and I have to update my card information my job is crazy up to something I think .. Anyways see ya shortly </div><div><br><div class=\"gmail_quote\"><div dir=\"ltr\" class=\"gmail_attr\">"
premailer = Premailer.new(body, with_html_string: true, warn_level: Premailer::Warnings::NONE, adapter: :nokogiri_fast)
 premailer.to_plain_text

It returns "Wow â\u0080¦ I got paid this morning I will b over Iâ\u0080\u0099m so so sorry\ngotta get a new lock that lock has been giving me nothing but\nproblems and I have to update my card information my job is crazy\nup to something I think .. Anyways see ya shortlyÂ".

Is it a new issue here?

Premailer Version: premailer (1.11.1)

@grosser
Copy link
Contributor

grosser commented Sep 21, 2023

sounds similar to #430

@tagliala
Copy link
Contributor

Yes, maybe this is not an issue anymore

@kishorech0817 is this still an issue?

@smeijer
Copy link

smeijer commented Mar 25, 2024

Had a similar issue, solved by setting the encoding to utf-8:

html.force_encoding('utf-8')

premailer = Premailer.new(
  html,
  with_html_string: true,
  input_encoding: 'utf-8'
)

@grosser
Copy link
Contributor

grosser commented Mar 26, 2024

can you make a PR to add to the readme to recommend how ppl should set this up ?

@tagliala
Copy link
Contributor

I think that this issue is specific to some setups, it would be interesting also to understand the causes (like nokogiri version (which can't be below 1.16 atm, source file, variable encoding, etc.)

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

No branches or pull requests

4 participants