final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
Log:
Process: com.example.kohlerkonnect, PID: 30162
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg=0x4000010 (has extras) } in com.thanosfisherman.wifiutils.wifiScan.WifiScanReceiver@1fd37de
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1656)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7971)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.IllegalArgumentException: passphrase not ASCII encodable
at android.net.wifi.WifiNetworkSpecifier$Builder.setWpa2Passphrase(WifiNetworkSpecifier.java:207)
at com.thanosfisherman.wifiutils.ConfigSecurities.setupWifiNetworkSpecifierSecurities(ConfigSecurities.java:125)
at com.thanosfisherman.wifiutils.ConnectorUtils.connectAndroidQ(ConnectorUtils.java:288)
at com.thanosfisherman.wifiutils.ConnectorUtils.connectToWifi(ConnectorUtils.java:181)
at com.thanosfisherman.wifiutils.WifiUtils$2.onScanResultsReady(WifiUtils.java:145)
at com.thanosfisherman.wifiutils.wifiScan.WifiScanReceiver.onReceive(WifiScanReceiver.java:20)
My Password was - "77€£¥¥♤◇☆"
This code cannot encode this type of passwords.
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder(); if (!asciiEncoder.canEncode(passphrase)) { throw new IllegalArgumentException("passphrase not ASCII encodable"); }
Log:
Process: com.example.kohlerkonnect, PID: 30162 java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg=0x4000010 (has extras) } in com.thanosfisherman.wifiutils.wifiScan.WifiScanReceiver@1fd37de at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1656) at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7971) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076) Caused by: java.lang.IllegalArgumentException: passphrase not ASCII encodable at android.net.wifi.WifiNetworkSpecifier$Builder.setWpa2Passphrase(WifiNetworkSpecifier.java:207) at com.thanosfisherman.wifiutils.ConfigSecurities.setupWifiNetworkSpecifierSecurities(ConfigSecurities.java:125) at com.thanosfisherman.wifiutils.ConnectorUtils.connectAndroidQ(ConnectorUtils.java:288) at com.thanosfisherman.wifiutils.ConnectorUtils.connectToWifi(ConnectorUtils.java:181) at com.thanosfisherman.wifiutils.WifiUtils$2.onScanResultsReady(WifiUtils.java:145) at com.thanosfisherman.wifiutils.wifiScan.WifiScanReceiver.onReceive(WifiScanReceiver.java:20)