Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: encoding issue with kettle data over a webservice

  1. #1

    Default encoding issue with kettle data over a webservice

    Dear all,

    I have an issue exposing Kettle data over a web service.
    I would like to use the getJSON jquery fonction to connect to connect to a webservice exposed by carte in order to feed the values of a drop down list. The issue is that accented characters are not displayed correctly in the drop down list.

    output on the browser :
    Name:  screenshot.png
Views: 124
Size:  8.1 KB

    content of the input file :
    Name:  Screenshot2.png
Views: 122
Size:  2.2 KB

    The transformation created is simple and only read the content of a UTF-8 encoded file and generate an "text file output" with the option "Pass output to servlet" activated. The encoding of the "text file output" is also UTF-8.

    In order to make this work, I had to configure apache as a proxy for carte to expose the webservice and the html page on the same server.

    I have attached all the files needed to make this work.

    Here is the html page :


    Code:
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
        $(document).ready(function () {
        
            $.ajaxSetup({ 
                scriptCharset: "utf-8" , 
                contentType: "application/json; charset=utf-8",
                cache: false
            })
            
            $.getJSON("http://cluster:cluster@computer_name/webservice/?trans=/var/www/test/transfo.ktr",{}, function(j){
                var options = '';
                for (var i = 0; i < j.length; i++) {
                    options += '<option value="' + j[i].clo1 + '">' + j[i].col1 + '</option>';
                }
                $("select#ctl").html(options);
            })
    
        })
    
    </script>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    
    
    <div>
        <form id="add_Video_Form" action="" method="post">
                <p>ctl
                    <select id="ctl" name="ctl"></select>
                </p>
        </form>
    </div>
    
    
    
    </body>
    </html>
    You have to activate mod_proxy and configure a virtual host in apache like this :

    Code:
    <VirtualHost computer_name:80>
        ServerAdmin webmaster@localhost
    
        DocumentRoot /var/www/test
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
        <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
    
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
        </Directory>
    
        ProxyRequests Off
        ProxyPreserveHost On
        
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
        
        ProxyPass /webservice http://cluster:cluster@localhost:8080/kettle/executeTrans/
        ProxyPassReverse /webservice http://cluster:cluster@localhost:8080/kettle/executeTrans/
        <Location /webservice>
            Order allow,deny
            Allow from all
        </Location>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
    
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    Next you need to unzip the attached archive in the folder /var/www/test .

    Run carte : ./carte 127.0.0.1 8080

    and access the link : http://computer_name/test_.html : you can see that the values of the dropdownlist doens't match the content of the file list.csv, we have some ? replacing the accented characters.
    But if we access http://cluster:cluster@127.0.0.1:808...st/transfo.ktr it works.
    And it works as weel with : http://cluster:cluster@computer_name...st/transfo.ktr .

    I am ussing Kettle 4.2.0-stable and I had the same issue with firefox and chrome.

    I don't understand why and where the issue is.

    thank you for the help.

    Erwan
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2011
    Posts
    257

    Default

    I also had problems with UTF-8...
    Try changing the encoding to WIN1252

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.