List Manager Forum

How to export list content with Chinse characters?

User moon_242 2012-01-24 03:15:29

I created a List with Chinese contents. It shows Chinese contents on the web site without problems. However, when I export my List to either pdf or Excel format, the Chinese contents do not show up instead showing with ?????. How can I show the contents with Chinese characters in pdf or Excel? Thanks.

Moonsoft support 2012-01-24 17:58:30

Hello,
the default pdf library we distribute with list manager can't handle chinese characters. We are going to send you to your email a new library with instructions to overwrite at your site configured to output chinese/japanese/korean letters.
When we have this working, we can move forward to the excel issue, more related to the encoding, because no external libraries are used for that task.

Hope this helps you, best regards
Moonsoft Team

Moonsoft support 2012-01-24 20:27:38

Hello,
your mail server rejects the attached files, so we've decided to add an entrance to the versions download. Please login and enter the download page of your component, so you will see the pdf pack to download. Unzip it first and follow the instructions on the txt file.
The new files configure the output to print chinese characters, please check it if it works as expected.

Best regards

User moon_242 2012-01-25 05:35:07

My joomla folder is called joomla2 so I pasted the folder 'mpdf' to \joomla2\components\com_listmanager\views\listmanager folder and overwrited the 'pdf.php' at \joomla2\components\com_listmanager\views\listmanager\tmpl\ with the new version.

Now, when I click to export pdf, I only get a blank page. The previous version will ask me to save the pdf file to my local computer. However, the new version does not ask for where to save the pdf file. Did I make something wrong?

User moon_242 2012-01-25 06:05:15

I reviewed the new pdf.php file and found the code:

$mpdf=new mPDF('+aCJK');

However, I did not see where you define the mPDF or include any php file from the "mpdf" folder. Am I missing something?

Moonsoft support 2012-01-25 10:52:24

Hi,
sorry, but it's US who have missed something. We forgot one change, as you stated, the new library import. We've just updated the zip to download, if you want to edit the file, this is the only change:

\joomla\components\com_listmanager\views\listmanager\view.pdfr.php


At the beggining, you should replace the export library used, this way:

// require('fpdf.php');

require_once('mpdf/mpdf.php');


Thank you

Best regards

User moon_242 2012-01-25 16:24:14

The Chinese characters are now shown as square boxes.

Moonsoft support 2012-01-25 21:57:26

Square boxes are usually related to the font used to print the characters. You can try to force the library to use a font able to print them. Please download again the pdf pack (hope this will be the last one) and overwrite the pdf.php file, it includes the style to use GB font, tested here and showed the chinese (simplified) without the boxes.

Hope this helps,

User moon_242 2012-01-26 01:17:50

The data contents show correct Chinese characters but the column titles still show as square boxes.

User moon_242 2012-01-26 01:22:32

One more question. Is it possible to select which columns of data to export in front-end page? I like to collect many columns of data but only need to generate certain columns of data when export to pdf or Excel. Thanks.

Moonsoft support 2012-01-26 13:27:09

Hello,
yes, the headers also should be forced to use the correct font (again at the pdf.php file). We changed this but we've realised it doesn't work well with single quotes, so it's changed now. We have uploaded the pack with changes to character encoding to get the excel output as well.

About your question, you have two options when exporting columns, export all of them, or only the columns marked as 'visible' at list configuration. Is a parameter you can find at module/component configuration called 'export all columns'.

If you want something more specific, then you may need to change the code, the pdf.php or excel.php files in order to select which of them you want to be printed.

Best regards
Moonsoft Team

User moon_242 2012-01-26 18:27:06

The PDF file is now correctly showing Chinese characters. Thanks. However, the Excel file does not show correctly. Here is one of the content.

"?∪??撣?/td>"

It shows not only the garbage code but also with "/td>". Can you check your php code for exporting to Excel format again. Sorry for bothering you so much.

Moonsoft support 2012-01-26 20:40:02

Hi,
it's ok, we are very interested in having this working too, so you're not bothering at all :)
Here we were getting a different output for excel, don't know exactly the reason, so we've changed again the excel part to some different encoding. Hope this works for you as well, please let us know if it finally shows up the correct symbols.

Best regards

User moon_242 2012-01-27 04:04:00

Everything works great except the List name which I also have Chinese characters. On the PDF format, I know how to modify to show Chinese characters in the List name but I don't know how to make the Excel changed.

Moonsoft support 2012-01-27 10:58:00

Hello,
great, seems we've got the point. So, in excel file (excel.php), you have the title printed at this line:


echo $this->title;

Please comment it and add a new one to get the correct encoding for the title string, this way:


//echo $this->title;
echo mb_convert_encoding($this->title, "HTML-ENTITIES","UTF-8");



That sould do the work, is same treatment is done to the rest of list data.

Best regards

Edited by MSTeam - 30.01.2012 16:01

User moon_242 2012-01-28 00:54:13

It works when I add "echo" in front of "mb_convert_encoding($this->title, "HTML-ENTITIES","UTF-8");". Everything is now working perfectly. Thanks again.

Moonsoft support 2012-01-30 10:45:47

Yes, the editor wrapped the line, now it reads ok.

Also the download at user section includes this title issue fixed.

Thank you, best regards

...
List Manager

Build different lists for your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!