File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
src/main/java/net/zetetic/tests Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 22
33import android .database .Cursor ;
44import net .sqlcipher .database .SQLiteDatabase ;
5+ import net .sqlcipher .database .SQLiteStatement ;
56
67public class UnicodeTest extends SQLCipherTest {
78 @ Override
89 public boolean execute (SQLiteDatabase database ) {
9-
1010 String expected = "КАКОЙ-ТО КИРИЛЛИЧЕСКИЙ ТЕКСТ" ; // SOME Cyrillic TEXT
1111 String actual = "" ;
12+
1213 Cursor result = database .rawQuery ("select UPPER('Какой-то кириллический текст') as u1" , new String []{});
13- if (result != null ){
14+ if (result != null ) {
1415 result .moveToFirst ();
1516 actual = result .getString (0 );
1617 result .close ();
1718 }
18- return actual .equals (expected );
19+ if (!actual .equals (expected )) return false ;
20+
21+ if (android .os .Build .VERSION .SDK_INT >= 23 ) { // Android M
22+ // This will crash on Android releases 1.X-5.X due the following Android bug:
23+ // https://code.google.com/p/android/issues/detail?id=81341
24+ SQLiteStatement st = database .compileStatement ("SELECT '\uD83D \uDE03 '" ); // SMILING FACE (MOUTH OPEN)
25+ String res = st .simpleQueryForString ();
26+ if (!res .equals ("\uD83D \uDE03 " )) return false ;
27+ }
28+
29+ // all ok:
30+ return true ;
1931 }
2032
2133 @ Override
You can’t perform that action at this time.
0 commit comments