• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
12

Import Chinese character from Unicode Text file into Adobe Forms

Community Beginner ,
Feb 18, 2024 Feb 18, 2024

Copy link to clipboard

Copied

I tried to import data from Excel that is exported as Text(Text Delimited) file which includes Chinese characters into Adobe Form, but those chinese Character won't be able to show up propertly in the form. 

However, when I tried to type some chinese character for testing, it works propertly. 

Could any experts help me out here since I had tried to read through so many workaround methods that I red online but still couldn't get it work?

Many Thanks!!!

TOPICS
PDF forms

Views

643

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

Chineses characters are coded as 16bit values, so the text file must be exported from Excel in utf-16 format. 

You should be able to open it in a code editor such as Notepad++ to check the format. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

Hi Thom, thanks for your reply. I tried to convert it to utf-16 format and re-imported again, then I got the error saying 'Could not load data from the text file'. Is that because Adobe cannot import utf-16 format text file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

I have not tried it myself, at least not using the import data option. But, Acrobat works just fine with UTF-16, so I would think it would load a text file just fine.  However, there could be a problem with the byte order markers. Were there any options for the export from Excel? 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

Hi Thom, I need to use the import data to allow me import my data externally into Forms. If there is any other ways, can you please show me?

In order to use the Import Data option, there are only a few file types that are supported: .fdf, .xfdf,.xml, .xfd, ,txt

I tried the .xml format before, converted to utf-16, still now working. Nothing happens after importing the data. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

I think you need to use XFDF for it to work. If you want it to work with a text file then you must use a script, which will allow you to specify the encoding of the text stream.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 19, 2024

Copy link to clipboard

Copied

I did a little bit of research and testing on this issue. It appears that Acrobat on Windows doesn't deal well with little endian UTF-16. 

I created a small excel sheet with some Thai, Arabic, and Chinese text on it, headers in English for the field names. Exported  from excel as "UNICODE Text", which produced utf-16 little endian.  When trying to two methods listed below to import the text, Acrobat refused to load for #1 and incorrectly interpreted the input data for #2.

Then I opened the text file in Notepad++ and converted it to Big Endian UTF-16. The results were better after this. 

 

Tried to import into a form in two ways. 

1. Using the Import Data menu item in the Prepare Forms tools.  This did not produce the "Cannot Read File" error (so Big Endian works), and displayed a popup for selecting the row. Unfortunately the displayed data was all garbage and it reported an error after selecting the row (cannot import data).

 

2. Using the util.readFileIntoStream, followed by util.stringFromStream, selecting for utf-16. Worked well for the English, Thai, and Arabic. But totally messed up the Chinese.  

 

Have not delved into this farther to find out how the Chinese character codes are being messed up.  But it's clear that they are fine when the text file is displayed in Notepad++. The characters can be copied and pasted into a form field in Acrobat. But when importing into Acrobat  the character codes were corrupted. 

 

So it looks like chinese is a bust. Perhaps using a different file format, as suggested by Try67 will produce better results.

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2024 Feb 20, 2024

Copy link to clipboard

Copied

LATEST

I was also doing some research of my own into this issue, and I was able to get it to work using a UTF-8 encoded text file. See attached sample.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines