M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 36
Registered: ‎09-23-2019

DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Is there a way to alter the default text encoding of a CSV file, created by DESKTOP app's query result? Maybe a workaround?

Highlighted
Technical Evangelist
Posts: 1,313
Registered: ‎09-11-2015

Re: DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Hi Eran,

 

I believe the Query API response is encoded in UTF-8 - isn't that enough for your needs? If you see incorrect characters, then maybe, they're encoded in the database improperly, or the Query API backend doesn't work with the character set correctly...

 

Thus my question - what is your observation? What is expected to see?

 

Also, make sure that Query API CSV response is to blame here, it could be, that the UTF-8 characters are not just correctly shown by the client which uses the Query API. You can use browser developer tools and see what you get in the query response.

 

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Contributor
Posts: 36
Registered: ‎09-23-2019

Re: DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Hi Jan,

Thank you for the answer.

 

What I observed is that the output encoding of the CSV varies according to OS locale\language, which is OK. For me it came as Windows-1255 and UTF-8 encoding for two different OS - Windows 2012 Server R2 and Windows 10 respectively. 

What I wanted to know, if there's a known way or workaround to define the output's encoding other than changing OS locale\language?

Highlighted
Technical Evangelist
Posts: 1,313
Registered: ‎09-11-2015

Re: DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Hmm, not sure if this is easily configurable, but you can possibly try to force globalization in the web.config:

<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Contributor
Posts: 36
Registered: ‎09-23-2019

Re: DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Hi Jan,

This seems like a real nice workaround but I need some more instructions in order to apply it:

  1. Adding this string is done manually, right?
  2. After adding this string do I need to restart IIS or IIS>M.App? Or maybe some recycling some pools?
  3. This string needs to be placed as an independent level under the main <configuration> level? Or should it be under a sub-level?

Thank's so far.

Highlighted
Technical Evangelist
Posts: 1,313
Registered: ‎09-11-2015

Re: DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

I'm not fully certain if it will work, but you can try it...

 

Please check the MSDN docs about this tag: https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.globalizationsection?view=netfr...

 

It is expected to be located anywhere in the <system.web> node.

<system.web>  
  <globalization   
    requestEncoding="utf-8"  
    responseEncoding="utf-8"/>  
</system.web> 

 

It should go to the web.config file in the root of MAE installation. After modifying the web.config, the application pool will recycle automatically.

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Contributor
Posts: 36
Registered: ‎09-23-2019

DESKTOP - Does text encoding of a query result CSV output can be determined before creation?

Unfortunately, adding this parameters to the 'web.config' file didn't seem to set the encoding of the output CSV. The CSV's encoding is still determind, as far as I understand, by the OS.

Thank you for the effort.