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 2
2
3
3
import android .database .Cursor ;
4
4
import net .sqlcipher .database .SQLiteDatabase ;
5
+ import net .sqlcipher .database .SQLiteStatement ;
5
6
6
7
public class UnicodeTest extends SQLCipherTest {
7
8
@ Override
8
9
public boolean execute (SQLiteDatabase database ) {
9
-
10
10
String expected = "КАКОЙ-ТО КИРИЛЛИЧЕСКИЙ ТЕКСТ" ; // SOME Cyrillic TEXT
11
11
String actual = "" ;
12
+
12
13
Cursor result = database .rawQuery ("select UPPER('Какой-то кириллический текст') as u1" , new String []{});
13
- if (result != null ){
14
+ if (result != null ) {
14
15
result .moveToFirst ();
15
16
actual = result .getString (0 );
16
17
result .close ();
17
18
}
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 ;
19
31
}
20
32
21
33
@ Override
You can’t perform that action at this time.
0 commit comments