Error message

You need to log in or create an account to access this page.

Archivée comes out as Archivée.
Patate sucrée (French for sweet potatoe) comes out as patate sucrée.

Problem with accents

I'm using entity_print-7.x-1.4+5-dev

Comments

bisonbleu created an issue. See original summary.

bisonbleu’s picture

Issue summary: View changes

Inserting image

bisonbleu’s picture

Issue summary: View changes
StatusFileSize
new43.12 KB

Annotated image.

benjy’s picture

Status: Active » Needs review
StatusFileSize
new321 bytes

Un-tested but can you try the attached patch?

bisonbleu’s picture

Hey @benjy. Patch applies cleanly. No changes though. Still seeing Archivée and sucrée.

benjy’s picture

StatusFileSize
new390 bytes

I'm unable to reproduce locally on the Drupal 8 version, I don't have the D7 version setup right now. Try the following patch instead and make sure you clear the cache first and don't have that template overridden in your theme or anything.

bisonbleu’s picture

Nope, no cigars yet ;-) No changes.

The context, although I don't think it matters, is Commerce Kickstart 2 /Omega sub-theme. I also tried with Bartik.

benjy’s picture

StatusFileSize
new399 bytes

I messed the patch up sorry, try this one.

bisonbleu’s picture

No luck.

Reverted last patch
Applied new patch
drush cc all
Tried as admin in FF
Tried as authenticated in Chrome

benjy’s picture

Hmm, not sure what else it could be and I can't reproduce it on the D8 version. Maybe you can propose a fix?

bisonbleu’s picture

I've installed and tested entity_print in a vanilla D7. Same problem with accents. I'm in the process of pushing this to a Pantheon test environment. This raises the issue of how to install wkhtmltopdf. More on this soon I hope.

Cheers

bisonbleu’s picture

Update.

I installed entity_print on a vanilla D7 on Pantheon.io and accents are broken in the PDF for Article nodes.

I'm not sure what more I can do.

bisonbleu’s picture

Priority: Normal » Major
Status: Needs review » Active

Setting back to active as well as major since, without support for accents, the module is broken for a lot of folks.

jordanpagewhite’s picture

I can also confirm this issue. I will review the code when I return from lunch because I also would like to use this module.

jordanpagewhite’s picture

StatusFileSize
new377 bytes

Adding a meta tag with charset="utf-8" fixed the issue for me. Please test it and let me know if it solves your issue. Thanks.

bisonbleu’s picture

Status: Active » Needs review

Thanks @jordanpagewhite, your patch fixes this issue AND, upon further review, @benjy's patch in #8 also fixes this issue - apologies.

So here's what's happening. In a vanilla D7 install patches in #8 and #15 fix the broken accents issue. This applies to 7.x-1.4 and 7.x-1.x-dev.

But copy the exact same code to a Commerce Kickstart 2 (CK2) install and it doesn't work - i.e. the accents remain broken. So it is fair to assume that CK2 is preventing the new entity-print.tpl.php from doing its job.

Any idea how I can solve this, where I should look?

p.s. While uninstalling, I found a bug in entity_print.install. Line 23 reads $rid_permissions = []; I believe that should be $rid_permissions = ''; right ?

benjy’s picture

Line 23 reads $rid_permissions = array(); for me which is correct.

benjy’s picture

Not sure about the Commerce Kickstart issue, if someone wants to take a closer look at that in the next few days we can fix it here as well otherwise i'll go ahead commit this issue.

bisonbleu’s picture

StatusFileSize
new1019 bytes

Attached, the entity_print.install from 7.x-1.x-dev

Line 22 and 23

  // Prepare permission array.
  $rid_permissions = [];

p.s. I'll report that in a new issue.

jordanpagewhite’s picture

StatusFileSize
new914 bytes

Give this a shot

Status: Needs review » Needs work

The last submitted patch, 20: 2718427-20.patch, failed testing.

benjy’s picture

O, of course the commerce order sub-module has a different template, bit of something extra in that patch but updating the other template should fix it.

bisonbleu’s picture

Yes, adding <meta charset="utf-8"> to entity-print--commerce-order.tpl.php fixes the broken accents issue in Commerce Kickstart. Thanks guys!

One last question. I have seen variants for this fix across different templates. Is there a definitive/best-practice one ?

Variation #1

<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">

Variation #2
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">

Variation #3
<meta charset="utf-8">

Let me know and I'll create the patch.

bisonbleu’s picture

After further investigation, it appears Variation #3 or <meta charset="utf-8"> is all that is required.

The attached patch adds this meta tag where it was missing (entity-print.tpl.php and entity-print--commerce-order.tpl.php).

Also, since entity_type requires PHP 5.4, I added this dependency in the .info file of the module. [Update: as of 2015-12-13, the PHP 5.4 dependency has been removed].

jordanpagewhite’s picture

That's a great question. I looked around and it seems like the shorter version, #3, is both easier to remember and the preferred HTML5 method. Good to know! Ha. You learn something everyday.

jordanpagewhite’s picture

Status: Needs work » Needs review

Also, I'm setting this to 'Needs review'.

jordanpagewhite’s picture

Can you elaborate on the PHP 5.4 requirement? Otherwise, I am fine to move to RTBC.

benjy’s picture

@bisonbleu this module does not have a requirement on PHP5.4, the syntax errors you reported were fixed months ago, I presume you just need to upgrade to the latest version.

  • benjy committed ca3ace9 on 7.x-1.x authored by bisonbleu
    Issue #2718427 by benjy, jordanpagewhite, bisonbleu: Accents are not...
benjy’s picture

Status: Needs review » Fixed

Thanks, committed #24.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.