Export Data with character Set

Hi,

How to export the data with the character set specified. I know the export dialog within Servoy has an option to specify the character set but don’t know how to do with the scripts

Can some one give me some thoughts on this?

Below is the code I use to export. Currently when I export foreign characters using this, the output is only with the questions marks (???)

var frmObj         = forms.homeList;
var totalRecords   = databaseManager.getFoundSetCount(frmObj.foundset);
globals.exportText = "";

for ( var i = 1 ; i <= totalRecords; i++ ) { 
   var currentRecord = frmObj.foundset.getRecord(i);
   globals.exportText +=  currentRecord['chi_title'] + "\n";
}

var success = plugins.file.writeTXTFile("C:/test.txt",globals.exportText);

Thanks

Default Java uses your platform(OS) char encoding, is that not what you want?

Jan Blok:
Default Java uses your platform(OS) char encoding, is that not what you want?

Thanks Jan..

Can I implicitly set the encoding when I export the data instead of using the default one since I have to handle different languages.

In Servoy’s export function you have an option to choose the encoding but don’t know why I cannot do scriptable import or export

Any more suggestions on setting the encoding please??

Million Thanks

encoding is now an optional paramter in the plugin function
http://downloads.servoy.com/downloads/b … n/file.jar
see sample code for how to get the encoding names

Thanks a lot Jan

I will try right now

Thanks again

Hi Jan, Hi Ahmad

I need to write a text file with the encoding Western (Windows Latin 1) on a Mac. As you say the File plug-in now has the optional parameter [charsetname]. But what name to use? Where can I get the list of encoding/charset names? Where can I get the below mentioned sample code?

Thanks for pointing me to the right place, Robert

Jan Blok:
encoding is now an optional paramter in the plugin function
http://downloads.servoy.com/downloads/b … n/file.jar
see sample code for how to get the encoding names

Move the sample code in the editor for the plugin function read or writeTxt file, you will see it contains a link to a page from SUN which contains the names to use for different en/decoders.

Hi Jan

Thanks, works as expected :-)

Regards, Robert

Jan Blok:
Move the sample code in the editor for the plugin function read or writeTxt file, you will see it contains a link to a page from SUN which contains the names to use for different en/decoders.