2
votes

I'm developing a backend that should accept JSON objects and input them in the datastore if they meet certain criteria. My problem is that i get crippled content when i send json that has unicode letters . I have tried it with both the api explorer and rest client plugin for Firefox

my endpoint API method looks like this:

    @ApiMethod(name = "addObj", httpMethod = "post" , path = "addObj")
    public ArtObj addObj(ArtObj obj)
        throws OAuthRequestException, IOException,IllegalArgumentException
    {

    }

and my Json looks like the following

{
   someText:"محتوى عربى",
   someEnglish : "English content"
}

According to many articles i did add this in my appengine-web.xml

<system-properties>
    <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
      <property name="file.encoding" value="UTF-8" />
    <property name="DEFAULT_ENCODING" value="UTF-8" />
</system-properties>

but all i receive is a parsed POJO but with garbled unicode letters and perfect english .

2

2 Answers

1
votes

I've found an answer to my question . I'm using windows and so the environment variable JAVA_TOOL_OPTIONS has to be set to -Dfile.encoding=UTF8 to set the default encoding for the JVM . now i get correct JSON .

Thanks

0
votes

I face the same problem to insert entity in Thai, my solutions is to open project properties window on Eclipse, under "Resource/Text file encoding" click "Other" and select "UTF-8" and it's work. enter image description here