You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by wengyao04 <we...@gmail.com> on 2019/06/12 16:24:54 UTC

Sql query cannot handle special character like ½

Some of our string fields contain special characters like  ½. When we use get
API to retrieve the object from the cache by key, and print out the field
having special characters,  the special characters are displayed correctly. 

However, when we use SqlFieldsQuery to select the field like the following

 String sql = "SELECT id, shortName from Warrant where id = ?";
 QueryCursor<List&lt;?>> cursor = mycache.query(new
SqlFieldsQuery(sql).setArgs("id1235"));
List<List&lt;?>> rows = cursor.getAll();
for (List<?> row : rows) {
    System.out.println(row.get(0) + " " + row.get(1));
}

The special character does not decode correctly, it shows "?" instead of "½"

How could we fix this problem when using SqlFieldsQuery  to query string
field containing special character ?

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Sql query cannot handle special character like ½

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

I expect that your System.out is not unicode. Can you try writing to file,
sending this file over? Can you do System.out.println(column.charAt(pos))?

Regards,
-- 
Ilya Kasnacheev


чт, 13 июн. 2019 г. в 22:01, wengyao04 <we...@gmail.com>:

> Hi I try it, but it does not work
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Sql query cannot handle special character like ½

Posted by wengyao04 <we...@gmail.com>.
Hi I try it, but it does not work



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Sql query cannot handle special character like ½

Posted by akurbanov <an...@gmail.com>.
Could you please try starting your java applications with
-Dfile.encoding=UTF-8 and check if it works?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/