$doc->Filename UTF-8 characters (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
philmills
User
Posts: 562

$doc->Filename UTF-8 characters (v2023)

Post by philmills »

I'm using the following to generate my export pdf filename:

$doc->FileName = Language()->phrase('StudentsIncidents_9') . "_{$recordId}_{$formattedDateTime}_(" . Language()->phrase('StudentsIncidents_11') . " " . date("d_m_Y @H_i") . ").pdf";

It's working fine except that if there are any non-latin characters in the generated filename they get incorrectly outputted.
e.g the letter ä will be output as ä in thge filename.

How can I get it to generate the filename correctly? Special characters are all correctly rendered throughout the site, it's only export filenames which are a problem


arbei
User
Posts: 9401

Post by arbei »

  1. Did you mean the exported file downloaded by your browser?
  2. Make sure your project charset is "utf-8" and your language files (with the added phrases 'StudentsIncidents_9' and 'StudentsIncidents_11') are correctly encoded in utf-8.

philmills
User
Posts: 562

Post by philmills »

  1. yes
  2. where is the project charset defined? I can't see such a setting
    the phyical file is encoded UTF-8, those language phrases 'StudentsIncidents_9' and 'StudentsIncidents_11' are both defined in languageLoad () function

v2023


arbei
User
Posts: 9401

Post by arbei »

  1. Project Charset,
  2. You better do die($doc->FileName) or Log($doc->FileName) to check if your file name are built in utf-8 correctly by your expression.

philmills
User
Posts: 562

Post by philmills »

  1. project charset is UTF-8
  2. I used die($doc->FileName) - filename is not built correctly

Post Reply