[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
changing csv file encoding  XML
Forum Index -> Development
Author Message
levy

Power User

Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline

Hi,

We often want to use the exportURLCsvWholeGrid, that is a great feature (like all features of CaptainCasa). In our customer clients, when opening such generated csv-files by the opensupported feature of captainCasa or by simply double clicking the file in the file explorer, the file is opened by MS-Excel. The rows are loaded as expected, but not the special characters like äöü. This is because the file is generated in UTF-8. If the file is converted to ANSI/ASCII (e.g. by means of Ultraedit or similar editors), then MS-Excel is happy and reads the characters as desired by default.

Unfortunately, there are no means to change in Excel this default behavior, the only way to read the UTF-8 file correctly is through the import assistant. Our users don't accept this multi-step way.

So my question is: How can I get the csv-file generated in ANSI/ASCII encoding? Perhaps by postprocessing or by setting an attribute or calling a method of CaptainCasa?

Regards, Daniel
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi Daniel,

all the exporting is done through a central "Exporter" which is accessed by FIXGRIDBinding.getExporter(). (FIXGRIDBinding is the main class of FIXGRIDListBinding etc.). getExporter() is by default passing back an instance of Exporter, which is an inner class of FIXGRIDBinding.


So, the principal way to extends it to your needs is:
(.) override FIXGRIDBinding
(.) define a new inner class MyExporter extends Exporter
(.) override the get-functions of Exporter and transfer the UTF-8 in a different result.

But, I believe what you desire is relevant for others as well... So we can make this configurable: either by a property of FIXGRIDBinding, or by a central configuration.

I believe, your preference would be to somehow generally define the csv-export characterset. Am I correct?

Björn

PS: effort is quite small for us, so if you answer quite fast it may make it into the next Monday's update...

Björn Müller, CaptainCasa GmbH
levy

Power User

Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline

Hi Björn,

Yes, I would like to define the csv-export characterset generally. Thus a new property for FIXGRIDBinding would be fine for us.

Thank you very much.

Daniel
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...part of today's update...
Björn

Björn Müller, CaptainCasa GmbH
levy

Power User

Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline

Works perfect, thank you!
[WWW]
amischler

Power User

Joined: 12/03/2015 13:53:14
Messages: 87
Offline

levy wrote:

Thus a new property for FIXGRIDBinding would be fine for us.
Daniel 


Some additional information:
The "new property" is called "exportcharactersetcsv" defined in the "system.xml" file (you will find the file in "webcontent/eclntjsfserver/config" path).

For example:
Code:
 <system>
      <fixgrid exportcharactersetcsv="ISO-8859-1" />     
 </system>
 


See also http://www.captaincasademo.com/forum/posts/list/1473.page
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team