You shouldn't include the value directly in your SQL at all. Instead, use parameterized SQL, such as:
Cursor cursor = db.rawQuery("SELECT * FROM category WHERE name=?",
new String[] { a });
That way:
- You don't need to worry about how non-ASCII should be represented
- You don't need to worry about escaping the data to avoid SQL injection attacks
- Your SQL is easier to read, without all the string concatenation
(In normal JDBC you could set parameters for other data types than String, avoiding conversion issues too - looks like that's not quite available here, but it's a common benefit of parameterized SQL.)