Special characters Mail Merge

Hi,

Currently, in my json, I have special character such as • . It’s not encoded. It’s exactly like this. Now, I have implemented the interface IMailMergeDataSource and I’m able to mail merge data into word template and generate the output. Everything comes fine except for this character the output is shown as 􀁇 . So what should I do in the code to ensure the mail merge document shows the character properly.

Regards,
Sandesh

@sandesh.dsouza

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Sample.zip (338.9 KB)

Hi Tahir,

Sorry for the late response. I have created the sample. sample_2.json has the data and you can see the special character in it. Also I have put the generated documents Windows.pdf in windows 7 box and Linux.pdf in Red Hat Enterprise Linux Server release 6.10 (Santiago) server.

In Windows it works fine. But in Linux, we are having this issue. It’ll be great if you can shed some light on how we can fix this issue.

Regards,
Sandesh

@sandesh.dsouza

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the Linux machine where you are converting documents to PDF. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

If you still face problem, please create simple Java application that has only Aspose.Words code to reproduce this issue at our end. Thanks for your cooperation.

Hi Tahir,

TrueType fonts are already installed in linux box. Please see the sample code I have attached in my earlier thread. Can you please take a look at it and suggest what I need to do to make it work?

Regards,
Sandesh

@sandesh.dsouza

We are working over your query and will get back to you soon.

@sandesh.dsouza

It seems that your issue is more related to reading the .json file. Please read the .json file with UTF-8 encoding as shown below. Hope this helps you.

byte[] buf = Files.readAllBytes(Paths.get(MyDir + "sample_2.json"));
String str = new String(buf,"UTF-8");

Hi Tahir,

It’s indeed an issue on the unicode character and from the frontend that I was not encoding it. That’s why issue came up. It’s all sorted now. Thanks for your help.

Regards,
Sandesh

@sandesh.dsouza

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.