Skip to content

Commit

Permalink
Change String encoding to StandardCharsets.UTF_8
Browse files Browse the repository at this point in the history
  • Loading branch information
wsciaroni committed Nov 8, 2024
1 parent 17b9001 commit e24a1c5
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e24a1c5

Please sign in to comment.