SELECT * FROM `question`
WHERE (`title` LIKE '%?????%' OR `questiontext` LIKE '%?????%' )
Hrm, I'm not sure what the problem is here. I've added the this UTF8 query-build test to the ormlite-core project and it passes fine.
Foo foo = new Foo();
foo.stringField = "اعصاب";
dao.create(foo);
List<Foo> results = dao.queryBuilder().where()
.like(Foo.STRING_COLUMN_NAME, foo.stringField).query();
assertEquals(foo.stringField, results.get(0).stringField);
This generates the following log output:
SELECT * FROM `foo` WHERE `string` LIKE 'اعصاب'
This also works with a SelectArg
which is how ORMLite does ?
args.
statement arguments: [اعصاب]
SELECT * FROM `foo` WHERE `string` LIKE ?
I initially thought that this was a problem with MySQL. Maybe you got the queries out of the server log? If you got the '?????' from a local log then I'm not sure what the issue is. Maybe the default character encoding for your application?
The tests are using H2 which is a native Java DB so can easily handle Java's strings. Maybe take a look at these MySQL questions/answers for help:
There is some talk about later versions of the MySQL connector fixing a problem with detecting the character type of the database.