javascript - HTML 转 PDF(带日语)

标签 javascript jquery html pdf export

我想使用 jquery 将 HTML 中的一些表格导出为 PDF 文件。 到目前为止,我可以使用 Ngiriraj 导出为 PDF,但它无法编码日语字符

Here is example

所以请帮我找到日语编码的方法

当我使用“全体デザイン”时,它显示“兡体ãςザイãς”

谢谢。

HTML

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="tableExport.js"></script>
<script type="text/javascript" src="jquery.base64.js"></script>
<script type="text/javascript" src="html2canvas.js"></script>
<script type="text/javascript" src="sprintf.js"></script>
<script type="text/javascript" src="jspdf.js"></script>
<script type="text/javascript" src="base64.js"></script>

<table id="nation">
<thead>         
    <tr class='warning'>
        <th>Nation</th>
        <th>Population</th>
        <th>Date</th>
        <th>%ge</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>中国</td>
        <td>1,363,480,000</td>
        <td>March 24, 2014</td>
        <td>19.1</td>
    </tr>
    <tr>
        <td>日本</td>
        <td>249,866,000</td>
        <td>July 1, 2013</td>
        <td>3.49</td>
    </tr>
</tbody>
</table>

PDF

Nation Population    Date           %ge
ä¸-国 1,363,480,000 March 24, 2014 19.1
日本 249,866,000   July 1, 2013   3.49

最佳答案

简单地说,字符编码表示字符(字母、数字和其他符号)如何表示为位和字节以进行存储和通信。客户端可以使用 HTTP 请求 header Accept-Charset 来指示如何对响应消息进行编码。

使用utf-16编码

关于javascript - HTML 转 PDF(带日语),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23509030/

相关文章:

javascript - 将上一个日期选择器中选择的日期设置为最小日期

php - 如何使用 jQuery 从模板文件调用函数

javascript - jquery .children() 的 .get()

javascript - 我可以使用 jQuery 删除内联事件处理程序吗?

php - Wordpress 开发人员自定义背景选项

javascript - 如何解码阿拉伯语的 html 内容以在 android webview 中显示?

javascript - :NOT selector in css is not working in my case

javascript - 如何清除 Vue v-list 中的事件项目?

javascript - Facebook Javascript-SDK 检查用户是否喜欢某个页面的方法

javascript - mtlLoader模块 "does not provide an export named ' MTLLoader'错误