Page 1 of 1
PDFGenerator and portuguese special characters
Posted: Mon Apr 13, 2020 7:24 pm
by TPrigas
Hello,
I'm using PDFGenerator module to create files from long text pages. The project I'm working on is mostly im portuguese. Therefore, there are special characters like "ç" "ã" "é" "ô" which the module seems not to deal very well and generates files almost unreadble like the following:
obrigatório espaço na contribuição para as soluções
Is there a workaround?
Thanks
Re: PDFGenerator and portuguese special characters
Posted: Fri Apr 17, 2020 11:29 am
by TPrigas
Hello!
Any sugestions?
Here's my system info:
----------------------------------------------
Cms Version: 2.2.14
Installed Modules:
AdminSearch: 1.0.5
CGExtensions: 1.65.2
CMSContentManager: 1.1.9
CmsJobManager: 0.1.3
DesignManager: 1.1.8
Disqus: 2.1.3
FileManager: 1.6.11
FilePicker: 1.0.4.1
Gallery: 2.4.2
MicroTiny: 2.2.4
ModuleManager: 2.1.7
Navigator: 1.0.9
News: 2.51.9
PDFGenerator: 1.0
Search: 1.51.8
Config Information:
php_memory_limit:
max_upload_size: 16000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Africa/Luanda
permissive_smarty: false
Php Information:
phpversion: 7.3.16
md5_function: On (Verdadeiro)
json_function: On (Verdadeiro)
gd_version: 2
tempnam_function: On (Verdadeiro)
magic_quotes_runtime: Off (Falso)
E_ALL: 32759
E_STRICT: 2048
E_DEPRECATED: 8192
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 180
register_globals: Off (Falso)
output_buffering: On
disable_functions: exec, passthru, shell_exec, system
open_basedir:
test_remote_url: Sucesso
file_uploads: On (Verdadeiro)
post_max_size: 16M
upload_max_filesize: 16M
session_save_path: /var/cpanel/php/sessions/ea-php73 (1733)
session_use_cookies: On (Verdadeiro)
xml_function: On (Verdadeiro)
xmlreader_class: On (Verdadeiro)
check_ini_set: On (Verdadeiro)
curl: On
Performance Information:
allow_browser_cache: On (Verdadeiro)
browser_cache_expiry: 60
php_opcache: Off (Falso)
smarty_cache: Off (Falso)
smarty_compilecheck: On (Verdadeiro)
auto_clear_cache_age: On (Verdadeiro)
Server Information:
Server Software: Apache
Server Api: fpm-fcgi
Server Os: Linux 3.10.0-1062.4.3.el7.x86_64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 10.3.22
Server Db Grants: Encontrada uma declaração "GRANT ALL" que parece ser adequada
Permission Information:
tmp: /home/ormedao/public_html/tmp (0755)
tmp_cache: /home/ormedao/public_html/tmp/cache (0755)
templates_c: /home/ormedao/public_html/tmp/templates_c (0755)
modules: /home/ormedao/public_html/modules (0755)
uploads: /home/ormedao/public_html/uploads (0755)
Mascara de Criação de Ficheiros (umask): /home/ormedao/public_html/tmp/cache (0755)
config_file: 0444
----------------------------------------------
Re: PDFGenerator and portuguese special characters
Posted: Wed Apr 22, 2020 1:14 am
by TPrigas
Hello guys,
I've figured out that the problem is not on PDFGenerator module but in the system it self. All content seem not to assume UTF8 but convert special characters used in portuguse to ASCII (like á to á ç to ç and so on).
Can't figure out how to avoid it, even with these tags set:
Code: Select all
<__html xmlns="http://www.w3.org/1999/xhtml" lang="pt">
<meta http-equiv="content-language" content="pt" />
Re: PDFGenerator and portuguese special characters
Posted: Wed Apr 22, 2020 11:52 am
by Jo Morg
On the PDF template of PDFGenerator replace {$body} with {'UTF-8'|iconv:'Windows-1252':$body}. That should do the trick!
Additional note: It's an issue with the fonts used by the PDF lib used in PHP which only support ANSI encoding. You can eventually install additional fonts supporting other encodings and character sets if you have the skills an knowledge but the easy way is just to convert from one encoding to the other.
HTH!
Re: PDFGenerator and portuguese special characters
Posted: Thu Apr 23, 2020 1:31 am
by TPrigas
Many thanks for the help Jo Morg. It really solved the problem! Anyway, I should check the fonts to avoid further problems
Thank you very much!