Hi Ruchira,

As per the offline discussion, it seems response.content always takes
ISO-8859-1 as the default encoding when setting the response content.
Replacing that line by print(json); can be used as a workaround.

Please find the JIRA created at [1] ;

[1] https://wso2.org/jira/browse/JAGGERY-398

Thanks,
Supun

On Fri, Nov 28, 2014 at 9:30 AM, Supun Sethunga <[email protected]> wrote:

> Hi,
>
> The scenario is, there's an backend OSGI service which reads some data
> from a csv file and sends it to the jaggery. The csv file can contain
> characters in different languages as well, hence it is read with UTF-8
> character encoding. When I try to assign the data received from the osgi
> service to the Jaggery response variable, it throws out the following
> exception saying certain characters are not  ISO 8859-1 encoded.
>
>
>> *ERROR {org.jaggeryjs.hostobjects.web.ResponseHostObject} -  Error
>> occurred while reading Servlet OutputStream*
>> *java.io.CharConversionException: Not an ISO 8859-1 character: ư*
>> * at javax.servlet.ServletOutputStream.print(ServletOutputStream.java:76)*
>> * at
>> org.jaggeryjs.hostobjects.web.ResponseHostObject.jsSet_content(ResponseHostObject.java:56)*
>> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
>> * at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)*
>> * at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)*
>> * at java.lang.reflect.Method.invoke(Method.java:597)*
>> * at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)*
>> * at
>> org.mozilla.javascript.ScriptableObject$GetterSlot.setValue(ScriptableObject.java:270)*
>> * at
>> org.mozilla.javascript.ScriptableObject.putImpl(ScriptableObject.java:2642)*
>> * at
>> org.mozilla.javascript.ScriptableObject.put(ScriptableObject.java:492)*
>> * at
>> org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:2347)*
>> * at
>> org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1598)*
>> * at
>> org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1592)*
>> * at
>> org.jaggeryjs.rhino.mlUI.site.importData.ajax.c0._c_script_0(/mlUI/site/importData/ajax/importDataset.jag:35)**
>> at
>> org.jaggeryjs.rhino.mlUI.site.importData.ajax.c0.call(/mlUI/site/importData/ajax/importDataset.jag)*
>
>
> Error is thrown from the 3rd line of follow. Please refer the attached
> file for the complete error log.
>
>>
>> *     response.contentType = "application/json; charset=utf-8";*
>> *     response.characterEncoding = 'UTF-8';**    response.content =
>> JSON.stringify(json);*
>
>
> Here 'json' is the data received from the backend service.
>
> However, this occurs when the csv file contains some Chinese/Latin
> characters and is read as UTF-8. But if the file is read as ISO-8859-1 and
> send to Jaggery, it works.
>
> Does Jaggery always use the ISO-8859-1 encoding?
>
> Thanks,
> Supun
> --
> *Supun Sethunga*
> Software Engineer
> WSO2, Inc.
> lean | enterprise | middleware
> Mobile : +94 716546324
>



-- 
*Supun Sethunga*
Software Engineer
WSO2, Inc.
lean | enterprise | middleware
Mobile : +94 716546324
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to