Puppeteerで日本語文字化けを防ぐRTA
たぶんこれが一番早いと思います
FROM buildkite/puppeteer:5.2.1
ENV LANG ja_JP.UTF-8
RUN apt-get update && \
apt-get -y install locales fonts-ipafont fonts-ipaexfont && \
echo "ja_JP UTF-8" > /etc/locale.gen && locale-gen
$ docker build . -t puppeteer_ja
実行
qiita.js
const puppeteer = require('puppeteer');
(async () => {
const url = 'https://qiita.com/';
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox'
]
});
const page = await browser.newPage();
await page.goto(url);
await page.screenshot({ path: 'image.jpg' })
await browser.close();
})();
$ node qiita.js
- image.jpg
qiita.js
const puppeteer = require('puppeteer');
(async () => {
const url = 'https://qiita.com/';
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox'
]
});
const page = await browser.newPage();
await page.goto(url);
await page.screenshot({ path: 'image.jpg' })
await browser.close();
})();
$ node qiita.js
Author And Source
この問題について(Puppeteerで日本語文字化けを防ぐRTA), 我々は、より多くの情報をここで見つけました https://qiita.com/skokado/items/a2a422c8636a919ce52f著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .