dokuwiki-plugin-dw2pdf
dokuwiki-plugin-dw2pdf copied to clipboard
Chinese punctuation becomes an unrecognizable character(□) when it's in front of english character
Hi All,
I ran into this problem when mixing english and chinese. For example,
。test
。is the chinese period. The chinese period becomes an unrecognizable character □
I have the same trouble .
Please could you provide a (small) php example of how you call mpdf?
Which versions (php, mPDF) are you using?
I just install "dw2pdf" into my dokuwiki and then use pagetool to export page.
Sorry ,this problem has any solution?
What is the language setting of our wiki?
The dw2pdf plugin add some settings to the mPDF library for a select set of languages. So I guess that if your wiki is set to one of these, the dw2pdf plugin has better language support for Chinese.
switch($conf['lang']) {
case 'zh':
case 'zh-tw':
case 'ja':
case 'ko':
$mode = '+aCJK';
break;
default:
$mode = 'UTF-8-s';
}
```
I use 'zh-tw' but the problem is still appearance.
Testing with a sample inputted directly into a standalone mPDF shows that 'mode' => 'zh-tw' let parse you example with the right Chinese character (but the English characters are have now a little strange font)
Trying this in DokuPDF class of dw2pdf doesn't have any effect.
more info about configurations: https://mpdf.github.io/fonts-languages/choosing-a-configuration-v7-x.html
Questions for @qwe852147 and @mkitby:
- Is dw2pdf only export wrong if there are single characters mixed with English?
- Is it working for bigger sections of text?
- Is there any Chinese text that is exported as expected?
So: when is it working, when not?
Sorry , I find this error is not about chinese punctuation. The error will appear when word is full-width.
Could you please provide examples of the wiki text?
For example use following full-width word
123456789
or
Test
Maybe https://github.com/mpdf/mpdf/issues/676 gives more insight in what happens here.
Note to self: mPDF config is at two locations:
- https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/blob/master/DokuPDF.class.php
- https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/blob/master/action.php#L385 in generatePDF()
Hello, everyone.
Any workaround here? seems it has not been fixed.
I tried to change the useSubstitutions of ./vendor/mpdf/mpdf/src/Config/ConfigVariables.php to true And change the backupSubsFont of ./vendor/mpdf/mpdf/src/Config/FontVariables.php to ['dejavusanscondensed', 'freeserif','freesans','sun-exta']
Nothing changed.
Need I do something else to make the config-changes validable?
Sigh.
I got the point. I need to modify all of the pages, add some empty lines but not only touch it to change the mtime. So that the cache invalid and make the pdf again.
More background available in: https://github.com/mpdf/mpdf/issues/305