pui.download problem with german umlaut

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
dabeda
New User
Posts: 17
Joined: Mon Jun 15, 2015 7:52 am
First Name: Peter
Last Name: L.
Company Name: VOG AG
Country: Austria
Contact:

pui.download problem with german umlaut

Post by dabeda »

Hello!

I am having troubles with the pui.download api. I have created the puidnlexit program with some additional code to fetch a BLOB from the database and create it with a temporary name in the IFS. Works great until the filename contains german or eastern european characters. I have tried everything I could think about already but no luck.
Displaying inline PDFs is also only possible as long as those characters are not present. Do I have to rename all the files or is there a better solution?

Regards
Peter
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: pui.download problem with german umlaut

Post by Scott Klement »

Which filename contains the characters that cause problems? Is it the temporary filename (which the user never sees) in the IFS? Or the attachment filename (that is sent to tbe browser)?

If it is the temporary filename that nobody sees... then why is it necessary to use these characters? Nobody will see it, anyway. But, this would be an internal IBM i issue if that is the case, since the filename does not come from or go to the display file. So anything that can be represented in the job's CCSID should work fine.

if it is the attachment filename, then it needs to be translated from EBCDIC to UTF-8 using the CCSID settings of your HTTP server instance. In that case, it should work without problems providing that the characters exist in the CCSID that you've configured Apache to use.
dabeda
New User
Posts: 17
Joined: Mon Jun 15, 2015 7:52 am
First Name: Peter
Last Name: L.
Company Name: VOG AG
Country: Austria
Contact:

Re: pui.download problem with german umlaut

Post by dabeda »

Hello Scott,

it's the attachment name that causes the problem. The filename field in the database is UTF-16.
I tried fetching it into an ucs2 variable and put it into a variable defined with ccsid 1141, that's the ccsid of the HTTP server instance. I also tried fetch into an UTF-8 and ccsid 1141 variable. In debugmode the attname field of the puidnlexit program shows all the needed characters, but on output the letters are corrupted.

Code: Select all

 dcl-s fileName varchar(128) ccsid(1141) inz;
 dcl-s utf8fileName varchar(256) ccsid(*utf8) inz;
 dcl-s ucsfileName varucs2(128) ccsid(*utf16) inz;      
 
 exec sql
           select data_field, file_name
             into :myfile, :ucsfileName
                  
  utf8filename = ucsfilename;
  
  filename = utf8filename;
  attname = filename;
  or
  attname = utf8filename;
  or 
  attname = ucs2filename;
         
It doesn't matter how i do it, the filename always looks the same.
So it seems that I'm doing something wrong. :-(
dabeda
New User
Posts: 17
Joined: Mon Jun 15, 2015 7:52 am
First Name: Peter
Last Name: L.
Company Name: VOG AG
Country: Austria
Contact:

Re: pui.download problem with german umlaut

Post by dabeda »

Same problem with the upload response field. If I try to upload a file with polish letters in its name, it is presented correctly in the upload widget, but as soon as the filenames arrive in the program, the letters are replaced with substitutional characters. I can only define the upload response as character field, the fields of the uploadinfo datastructure are defined as char. Even if I define them with ccsid(*utf8) the data still goes missing, since my job runs with CCSID 1141. An upload from a job with CCSID 1153 works. We have to be able to upload documents with different languages in their names, since we cannot control this.
Am I missing something in the configurations?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: pui.download problem with german umlaut

Post by Scott Klement »

The CCSID keyword inside your RPG program or database will only change things inside your RPG program or database. It does not change things inside
Profound UI or the Apache web server, so cannot work.

As I said in my earlier message, it will be translated using the CCSIDs in your Apache HTTP server configuration.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests