[Solved] Export values with accent (PT-BR ISO-8859-1) to CSV

Moderator: crythias

Post Reply
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

[Solved] Export values with accent (PT-BR ISO-8859-1) to CSV

Post by amdkryn »

Hi!

I need to export values with accent (ã, õ, á,ó...) to CSV
file from OTRS Survey, but isn't possible.

Link for example:
http://server/otrs/index.pl?Action=Agen ... SurveyID=2

Each column that has accent is truncated in file exported.

How can i change the character encoding from the export model to
ISO-8859-1?

Files module for package - Survey CSV Export
Kernel/Config/Files/SurveyExport.xml
Kernel/Modules/AgentSurveyExport.pm
Custom/Kernel/Modules/AgentSurveyZoom.pm
Kernel/Output/HTML/Standard/AgentSurveyZoomExport.dtl

Any help is appreciated...
Thanks
Last edited by amdkryn on 22 Mar 2014, 23:40, edited 2 times in total.
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Export values with accent to CSV - Help

Post by reneeb »

What's the encoding of your DB?
For the future: You should say which add ons you have installed. The export is neither standard OTRS nor part of the Survey add on. It's an extra add on available on OPAR.


The module sets "utf-8" as the charset in Kernel/Modules/AgentSurveyExport.pm. Search for "Attachment(". Change the utf-8 to iso-8859-1. Please keep us informed whether this fixes your problem.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: Export values with accent to CSV - Help

Post by amdkryn »

I do not sure, I believe that is the default.
A consultant had already corrected other reports, but this has not yet and I want to learn to solve.

I changed the quoted text did not work. Any other suggestions?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
Mike_B
Moderator
Posts: 266
Joined: 12 Jan 2010, 18:16
Znuny Version: CVS HEAD

Re: Export values with accent to CSV - Help

Post by Mike_B »

There was a byte-order-mark in the CSV export; see here for the fix (and let me know if it works for you!!)
https://github.com/tuxwerk/OTRS-SurveyExport/pull/1
huntingbears.nl - @michielbeijen on Twitter
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: Export values with accent to CSV - Help

Post by amdkryn »

I copied the code and saved in place of the original but the accents do not work yet. Any other tips?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: Export values with accent to CSV - Help

Post by amdkryn »

amdkryn wrote:I copied the code and saved in place of the original but the accents do not work yet. Any other tips?
Someone?
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: Export values with accent to CSV - Help

Post by amdkryn »

BUMP :)
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
amdkryn
Znuny expert
Posts: 187
Joined: 02 Oct 2012, 02:52
Znuny Version: 5.0.27

Re: Export values with accent to CSV - Help

Post by amdkryn »

For those interested, the problem of exporting the report with accents (PT-BR) was solved with the following configuration (/opt/otrs/Custom/Kernel/Modules/AgentSurveyExport.pm):


Under "user Kernel ::System::HTMLUtils;" add "use Encode;" and in line 110, change as code below:

Code: Select all

    return $Self->{LayoutObject}->Attachment(
	Filename    => "survey.csv",
	ContentType => "text/csv",
	Content     => encode("iso-8859-1",$CSV),
    );
}

1;
[/b]

Fuçando nos meus sistemas encontrei como foi configurado o AgentSurveyExport.pm, precisa adicionar o "use Encode;" no inicio do arquivo pra usar essa função e a partir da linha 110 alterar o código conforme exemplo acima em inglês.
OTRS version 5.0.27 (With ITSM), Operating System OpenSuse 12 with Mysql.
Post Reply