Different Charset In Android Os Version
I am writing an AES code for encryption and I realized different version of Android encrypt differently. I took sometime to Google and read something about getBytes() are subject t
Solution 1:
You can pass encoding to getBytes()
. Example:
StringmyString="test";
byte[] bytes = myString.getBytes("UTF-8");
For a list of supported values see: http://developer.android.com/reference/java/nio/charset/Charset.html
EDIT
I see. But I don't understand why different versions of Android encrypt differently. Even it uses different libraries, the standard should be the same...Weird. Maybe you can try to implement your own getBytes()
then it will work exactly same on all versions. I found this example: http://www.javacodegeeks.com/2010/11/java-best-practices-char-to-byte-and.html
Post a Comment for "Different Charset In Android Os Version"