[jira] [Created] (ZEPPELIN-2641) Livy interpreter doesn't support Chinese encoding

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Created] (ZEPPELIN-2641) Livy interpreter doesn't support Chinese encoding

JIRA jira@apache.org
heyang wang created ZEPPELIN-2641:

             Summary: Livy interpreter doesn't support Chinese encoding
                 Key: ZEPPELIN-2641
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-2641
             Project: Zeppelin
          Issue Type: Bug
          Components: livy-interpreter
    Affects Versions: 0.7.1, 0.8.0
            Reporter: heyang wang
            Priority: Critical

When using Livy to interact with spark. Spark sql with Chinese character always return empty result.

The reason is because Zeppelin use restTemplate.java from  spring frame work. When sending restful request to Livy, the headers is defined as Content-Type:application/json. This setting doesn't specify the encoding of the charset and spring will use ISO-8895-1 by default. But ISO-8895-1 isn't compatible with Chinese. The code Livy receive from Zeppelin contain invalid Chinese encoding and will be interpret by spark as ?.

Change header from  application/json to MediaType.APPLICATION_JSON_UTF8_VALUE in BaseLivyInterpreter.java and rebuild can solve this problem.

It seems encoding problem affect more than Chinese since ISO-8895-1's coverage is restricted. I think update the encoding to UTF-8 would be helpful.

This message was sent by Atlassian JIRA