dokuwiki-plugin-dw2pdf icon indicating copy to clipboard operation
dokuwiki-plugin-dw2pdf copied to clipboard

Chinese punctuation becomes an unrecognizable character(□) when it's in front of english character

Open mkitby opened this issue 8 years ago • 14 comments

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 □

mkitby avatar Apr 27 '17 01:04 mkitby

I have the same trouble .

qwe852147 avatar Jul 13 '17 07:07 qwe852147

Please could you provide a (small) php example of how you call mpdf?

Which versions (php, mPDF) are you using?

Klap-in avatar Jul 13 '17 11:07 Klap-in

I just install "dw2pdf" into my dokuwiki and then use pagetool to export page.

qwe852147 avatar Jul 17 '17 08:07 qwe852147

Sorry ,this problem has any solution?

qwe852147 avatar Nov 08 '17 03:11 qwe852147

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';
        }
```

Klap-in avatar Nov 08 '17 08:11 Klap-in

I use 'zh-tw' but the problem is still appearance.

qwe852147 avatar Nov 08 '17 08:11 qwe852147

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?

Klap-in avatar Dec 13 '17 22:12 Klap-in

Sorry , I find this error is not about chinese punctuation. The error will appear when word is full-width.

qwe852147 avatar Dec 21 '17 08:12 qwe852147

Could you please provide examples of the wiki text?

Klap-in avatar Dec 21 '17 09:12 Klap-in

For example use following full-width word 123456789 or Test

qwe852147 avatar Dec 21 '17 09:12 qwe852147

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()

Klap-in avatar Mar 09 '18 07:03 Klap-in

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?

zeerd avatar Apr 20 '20 08:04 zeerd

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.

zeerd avatar Apr 23 '20 03:04 zeerd

More background available in: https://github.com/mpdf/mpdf/issues/305

Klap-in avatar Jun 05 '22 12:06 Klap-in