Charset issue in dropdown

Moderator: crythias

Locked
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Charset issue in dropdown

Post by GMunjal »

Hi,
We implement OTRS and we are using external data source to show data in dropdown.

How we implement : we create a file extdata.pl in bin . on browsing this file it shows content as

Code: Select all

<option value="IKO999-99">IKO999-99 Dummy [b]für [/b]EA-Verwaltung (ohne Abrechnung)</option>
Check the für above, which is shown in correct way.

Issue : Now the issue is, when we bind these external data source values with dropdown, the same value will change as shown in attached image(Please find attached image).

Please provide the inputs that how can we show the correct values in dropdown.
You do not have the required permissions to view the files attached to this post.
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: Charset issue in dropdown

Post by reneeb »

Does your script send the data as utf-8?
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
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Charset issue in dropdown

Post by GMunjal »

We tried to open execute the script first in SQL...in SQL it work right.

Then we tried to execute the http://1.1.2.2/otrs/extdata.pl in chrome browser, but in browser it shows us the same issue.

But if we execute the http://1.1.2.2/otrs/extdata.pl in Iternet explorer and save the file, and then open it using text file, in Text file it shows the right results.

So overall - If we check in browser it shows wrong result.
But if we open in using notepad, is shows right result.

any inputs to correct this ?
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: Charset issue in dropdown

Post by reneeb »

reneeb wrote:Does your script send the data as utf-8?
again...
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
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Charset issue in dropdown

Post by GMunjal »

No
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: Charset issue in dropdown

Post by reneeb »

Then you should change that... OTRS output is utf-8 encoded, so you should do that, too.
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
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Charset issue in dropdown

Post by GMunjal »

Hi,

We change the script, now our script output data as UTF-8. below is the output of script attached

Output in DB :
DBOut.png
Output of extdata.pl :
fileOut.png
Issue -

But when we bind this file on UI, it looks like as below in dropdown :
dropOut.png

So can you please update us, where is the issue that on GUI the format is not correct seen ?
Also let us know if more description required...
You do not have the required permissions to view the files attached to this post.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Charset issue in dropdown

Post by jojo »

I eally doubt that it has the correct format.
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Charset issue in dropdown

Post by GMunjal »

One more input to describe the issue:

If I execute the extdata.pl in IE, It popups for save the JSON file. that JSON file shows us the correct format.

But if we execute the extdata.pl in chromeBrowser than it will show us the wrong format as it shows us in dropdown.

I check in SQL server from where we get the data , the collation type is Latin1_General_CI_AS in SQL.

Below is the snapshot of extdata.pl. May be it will help you to get some more information for this issue.
extdata.pl.png
You do not have the required permissions to view the files attached to this post.
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Charset issue in dropdown

Post by GMunjal »

Any updates on the above issues ?????
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Charset issue in dropdown

Post by jojo »

your databse has the wrong charset. If you require commercial support you should consider buying it
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
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: Charset issue in dropdown

Post by reneeb »

Your "SourceCharset" attribute has no effects. Kernel::System::DB doesn't know anything about that attribute. So you have to write your own layer like Kernel::System::CustomerUser::DB where the encoding/decoding is done. And in that layer you have to use the encoding names the Perl module Encode (http://metapcan.org/pod/Encode) supports.
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
cryptoroot
Znuny newbie
Posts: 26
Joined: 10 Jul 2014, 19:58
Znuny Version: 4.0.3
Real Name: Jorge Rojas
Company: Instituto Costarricense de Electricidad
Location: Costa Rica

Re: Charset issue in dropdown

Post by cryptoroot »

I know this thread is old, but recently I have resolved this problem doing a little change in the example of extdata.pl.

Code: Select all

use strict;
use warnings;
#Add Encode
use Encode; 

use CGI qw(:standard);
#use JSON; #install JSON via cpan/ppm if you want to use it instead

#Add to the print header -charset => 'utf-8'
print header(-type => 'application/json', -charset => 'utf-8');
The problem is the original code didn't specify the charset. although db has the correct setting
Locked