Complete

WERETECH-10739

Fixed

Bug in compilator , with String.equals and utf8 symbol

Function Always show false, but symbol the same. 

var dTExt = "";  

Toybox.System.println( ((dTExt.equals("") ))  );  


Parents
  • Okay, I think I finally understand. Your original post said that symbol the same, but that is not the case. The utf8 code points are indeed different. Here is a test case that illustrates the problem much more clearly and avoids the possibility of the utf8 characters getting munged by the forum software.

    //var a = "";
    var a = "\uEACA";
    		
    //var b = "";
    var b = "\uEACB";
    		
    System.println(a.equals(b));
    System.println(b.equals(a));

    This incorrectly prints

    true
    true

    If I append another character (say "Z") to the strings, then the difference is properly detected.

Comment
  • Okay, I think I finally understand. Your original post said that symbol the same, but that is not the case. The utf8 code points are indeed different. Here is a test case that illustrates the problem much more clearly and avoids the possibility of the utf8 characters getting munged by the forum software.

    //var a = "";
    var a = "\uEACA";
    		
    //var b = "";
    var b = "\uEACB";
    		
    System.println(a.equals(b));
    System.println(b.equals(a));

    This incorrectly prints

    true
    true

    If I append another character (say "Z") to the strings, then the difference is properly detected.

Children
  • Yes. ) now to equal that symbols i just added other not utf8 symbol. 
    I long time didn't understand, why simple function give my wrong results) 

    *offtop 
    In suggestion  add  a callback function to the sdk WatchUi.WatchFace 
    Determinate when something drawing on the screen message like: ("Connection lost/established", "Low phone battery", "chime o'clock")
    run before the last onUpdate() calling
    Function very needed for energy efficient wachface. Now i wrote "crutches" instead  of her  (by counting the number of step-by-step onUpdate calls)