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

puppeteer from html to pdf arabic fonts are not showing #4424

Closed
syednoor6208 opened this issue May 14, 2019 · 13 comments · Fixed by #4433
Closed

puppeteer from html to pdf arabic fonts are not showing #4424

syednoor6208 opened this issue May 14, 2019 · 13 comments · Fixed by #4433

Comments

@syednoor6208
Copy link

delete all npm modules and packagelock.json then do npm install arabic text is showing junk values.
Screenshot 2019-05-14 at 4 35 49 PM

@DvdGiessen
Copy link

DvdGiessen commented May 14, 2019

See #4364 (comment). Seems this was caused by 27c9f75.

A minimal testcase:

const fs = require('fs');
const puppeteer = require('puppeteer');
(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.setContent('😃');
    fs.writeFileSync('out.png', await page.screenshot());
    await browser.close();
})();

When run using 1.15, this correctly outputs:
out_1_15

When run using 1.16, which includes mentioned commit, this incorrectly outputs:
out_1_16

@aslushnikov

@zeeshanaligold
Copy link

zeeshanaligold commented May 15, 2019

Hi @syednoor6208
Having same issue with me! did you fix?

@syednoor6208
Copy link
Author

Hi @syednoor6208
Having same issue with me! did you fix?

Not yet...

@syednoor6208
Copy link
Author

Hi @zeeshanaligold i have old "puppeteer" node_modules which is working fine...
file is very big i can share via wetransfer, if required share ur email id.

@zeeshanaligold
Copy link

Hi @syednoor6208
Yea, i know puppeteer v(1.15) is working perfect. Just issue in v1.16.
Thanks,

@kzkn
Copy link

kzkn commented May 15, 2019

I have same issue.

Yea, i know puppeteer v(1.15) is working perfect. Just issue in v1.16.

It's also same.

@semoal
Copy link
Contributor

semoal commented May 15, 2019

Same issue here with Spanish accents.

@semoal
Copy link
Contributor

semoal commented May 15, 2019

I got a fix, i'll post a pull request in a while!

semoal pushed a commit to semoal/puppeteer that referenced this issue May 15, 2019
This patch fixes page.setContent with unicode strings that exceeds the range of a 8-bit byte.

Fixes puppeteer#4424
@SWGFL
Copy link

SWGFL commented May 16, 2019

Same issue here, v1.15.0 arabic and UTF-8 characters exported as a PDF come out correctly, v1.16.0 it is all messed up.

@Kenshinhu
Copy link

Same issue here @v1.16

aslushnikov pushed a commit that referenced this issue May 18, 2019
Fix `page.setContent` with unicode strings that exceeds the range of a 8-bit byte.

This patch implements decoding part of the [MDN's solution #4 for the "unicode problem"](https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_4_%E2%80%93_escaping_the_string_before_encoding_it).

Since we rely on node.js buffer to encode into base64, we don't have troubles with base64 encoding, so it is left as-is.

Fixes #4424
@saintego
Copy link

It's broken again in 1.20. In 1.19 works fine

@bartlomiejzuber
Copy link

Same issue here @v.1.20

@codingedgar
Copy link

Right now I'm trying to do await page.type(' \u0000 '); but when I get the value of the element:

 return page
    .$(selector)
    .then(el => {
      return el?.evaluate(el => {
          return (el as HTMLTextAreaElement).value;

I only get the spaces.

To be more accurate, I type : [32, 0 ,32] chars but I get [32, 32] , the 0 is missing, not sure why.

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 a pull request may close this issue.

9 participants