Skip to content

Commit

Permalink
Fix bug in getString involving character encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
LandryNorris committed Jul 14, 2022
1 parent 046f92d commit b0b21e5
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ fun CPointer<JNIEnvVar>.getStringChars(string: jstring): CPointer<jcharVar>? {
}

fun CPointer<JNIEnvVar>.getString(string: jstring): String {
val chars = getStringChars(string)
return chars?.toKString() ?: error("Unable to create a String from the given jstring")
val chars = getStringUTFChars(string)
return chars?.toKStringFromUtf8() ?: error("Unable to create a String from the given jstring")
}

fun CPointer<JNIEnvVar>.releaseStringChars(string: jstring, chars: CPointer<jcharVar>?) {
Expand Down
Binary file modified sample/src/androidMain/jniLibs/arm64-v8a/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/armeabi-v7a/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/x86/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/x86_64/libsample.so
Binary file not shown.

0 comments on commit b0b21e5

Please sign in to comment.