1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-23 13:30:48 +02:00

Ensure we now escape chars in the unicode start range. With Bangle.js ~2v18.20+ we added Unicode support, but if we're sending non-unicode chars in the unicode range it will confuse Espruino

This commit is contained in:
Gordon Williams 2023-06-26 11:07:38 +01:00
parent cc9c8d4207
commit 94cd7523db

View File

@ -381,7 +381,8 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
else if (ch==12) json += "\\f";
else if (ch==34) json += "\\\""; // quote
else if (ch==92) json += "\\\\"; // slash
else if (ch<32 || ch==127 || ch==173)
else if (ch<32 || ch==127 || ch==173 ||
((ch>=0xC2) && (ch<=0xF4))) // unicode start char range
json += "\\x"+Integer.toHexString((ch&255)|256).substring(1);
else json += s.charAt(i);
}