From e24a1c56bd1fa4ecdf04c6bb752fe9bb866cd07c Mon Sep 17 00:00:00 2001 From: William Sciaroni Date: Fri, 8 Nov 2024 16:29:48 +0000 Subject: [PATCH] Change String encoding to StandardCharsets.UTF_8 --- .../vagell/kv4pht/radio/RadioAudioService.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/radio/RadioAudioService.java b/android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/radio/RadioAudioService.java index 7b5911a..4f88075 100644 --- a/android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/radio/RadioAudioService.java +++ b/android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/radio/RadioAudioService.java @@ -945,18 +945,18 @@ public synchronized void sendBytesToESP32(byte[] newBytes) { private void handleESP32Data(byte[] data) { // Log.d("DEBUG", "Got bytes from ESP32: " + Arrays.toString(data)); - try { - String dataStr = new String(data, "UTF-8"); -// if (dataStr.length() < 100 && dataStr.length() > 0) - Log.d("DEBUG", "Str data from ESP32: " + dataStr); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + // try { + String logDataStr = new String(data, StandardCharsets.UTF_8); + // if (logDataStr.length() < 100 && logDataStr.length() > 0) + Log.d("DEBUG", "Str data from ESP32: " + logDataStr); + // } catch (UnsupportedEncodingException e) { + // throw new RuntimeException(e); + // } // Log.d("DEBUG", "Num bytes from ESP32: " + data.length); if (mode == MODE_STARTUP) { try { - String dataStr = new String(data, "UTF-8"); + String dataStr = new String(data, StandardCharsets.UTF_8); versionStrBuffer += dataStr; if (versionStrBuffer.contains(VERSION_PREFIX)) { int startIdx = versionStrBuffer.indexOf(VERSION_PREFIX) + VERSION_PREFIX.length();