1
$\begingroup$

folowing is the content my test nb File: pdfTest.nb, contain some chinese characters:

SampleCode1:pdf输入不正常。

After Save as or Export, pdf file looks well for the Chinese content.

But when Import, it seems become WindowsANSI Encoding.

When I Import the pdf file

Import["E:\\Users\\Quaternions\\Desktop\\pdfTest.pdf","Plaintext",CharacterEncoding->"CP936"]

Show this

SampleCode2:pdfÊäÈë\.b2»Õý\.b3£¡£

When I Export and Re-Import the .txt file, it works fine.

Import[Export["temp1.txt",%,CharacterEncoding->"WindowsANSI"],CharacterEncoding->"CP936"]

good result:

pdf输入不正常。

my-enviroment is windows 8 mathematica 9.0 chinese version.

$CharacterEncoding
CP936

Maybe someone is hard to test.

My question is:

1: How to directly import the pdf file contain chinese characters and show well.

2: if the solution for question 1 is not possible, is it necessary to Export using CharacterEncoding->"WindowsANSI" and re-Import? ,

ie. How to convert the characterEncoding in notebook without the export manipulation? Convert SampleCode2 to SampleCode1

Futhermore, When I import some pdf generated by Tex or obtain other where, also will encouter with CharacterEncoding Problem. I think Import Pdf File should better add an Elements that Import pdf pages as Rasterized image list.

$\endgroup$
4
  • $\begingroup$ @ruebenko sorry for that, Let me edit , I think I mis-edit them by myself. I just wanna make them a littel different in appearance $\endgroup$ Commented May 8, 2013 at 13:02
  • 1
    $\begingroup$ Hi HyperGroups, I think the chinese version Mathematica might use different UnicodeLanguageFontMapping.tr file than english/japanese version. And there might be some other differences as well. But unfortunately, most people (including me) on this site don't have any access to chinese versions to test your problem, so it could be hard here to get a complete answer for your question. Nevertheless, I would suggest you investigating the problem with help of some HEX/Binary file viewer, and with a deeper understanding about character encoding, GBK, UTF-8, Unicode, etc. $\endgroup$
    – Silvia
    Commented May 8, 2013 at 17:23
  • $\begingroup$ @Silvia, thanks for tips about encoding, I remember that Export pdf cause some encoding problem with characters in Chinese before the Chinese version was released. And this(export) was solved after the Chinese version released. $\endgroup$ Commented May 9, 2013 at 2:30
  • $\begingroup$ I remember some problem with GBK characters, but not sure whether they are solved or not. About the encoding, You may want to check out this: Quiet[Outer[Check[FromCharacterCode[ToCharacterCode["en汉字",#1],#2],$Failed]&,#,#]&@$CharacterEncodings]. $\endgroup$
    – Silvia
    Commented May 9, 2013 at 7:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.