Downloading CSV file with Thai characters issue
Application Type
Traditional Web
Service Studio Version
11.14.10 (Build 59113)

Hi all, seeking any help on my current issue in downloading CSV file.

I have a requirement that I need to download a CSV file from OutSystems and it has Thai characters on it.

The content of the CSV file is dynamic, with that said I cannot use the Record List To Excel which seems to work on the extraction of Thai characters but will not be usable in my case because you need to define a structure on this function and our data is dynamic and assembled in comma-separated for CSV output.

I created an OML for you to see.



If you convert Thai Text to Binary Data then Convert that Binary Data to Text by using utf-8 encoding on both and display the result in the UI, the Thai characters are displayed properly.





But if you Convert Thai Text to Binary then Download that binary with CSV file extension, it will not display the Thai characters as expected.


Am I missing any configuration? I assume this should work as we were able to display the converted Binary in the UI.

Unicode encoding did not work as well.

Any help will be highly appreciated. Hope there are any solutions or alternatives on this one.

Please see attached file for the sample running code.


ThaiExtract.oml

Hi John,

Greetings,

In the above solution you are creating the CSV file with Outputs utf-8 no BOM . If you open the CSV file as notepad than the data seems correct refer below image.

It means in order to render the correct data in csv we need to save the file with utf-8 including BOM

- Byte Order Mark(BOM)+Text

BOM is 3 characters (EF BB BF) to mark the file is encoded as UTF-8.

and to add the binary data BOM + text we need to use a forge component  Binary Concat

https://www.outsystems.com/forge/component-overview/2067/binary-concat

 above highlighted BOM is added with the Text and below is the screenshot of Thai text in CSV

and attached is the working sample and below is the community useful link.

https://www.outsystems.com/forums/discussion/37973/specific-file-type-and-encoding/

Best Regards

Devendra

ThaiExtractSolved.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.