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