Possible Characters issue

Hi mates,

so I may experienced a characters issue,

I was reported a date missing characters (big square) so I checked my code and the missing characters were already put in it.

So I made some tests,

for exemple, let say czech characters. the month is: říjen

all the characters are included in my cutsom font (in resources folder)

if I execute the code, I have squares for "special" characters (Date.Month)

but if I put manually in dc.drawText => "říjen", no issue, the month is well spelled.

Is it possible that "Garmin" returns wrong value/ char code ?

(if I use native font, i don't have the right value either, I get special charactres)

using Eclipse

  • PS: the wf was released 1 year ago with no issue, even on the sim when I worked on it.

  • If you built an iq with VS Code recently, there is a fix in the 0.1.4 extension to use UFT8, as Eclipse does

  • hi Jim, I use Eclipse and UTF8 option is checked

  • Should I open a ticket or did I miss something ? 

  • I'm afraid I don't fully understand the problem you're describing.

    var font = WatchUi.loadResource(Rez.Fonts.MyFont);
    var cx = dc.getWidth() / 2;
    var cy = dc.getHeight() / 2;
    var fy = dc.getFontHeight(font);
    // I put manually in dc.drawText => "říjen", no issue
    dc.drawText(cx, cy, font, "říjen", Graphics.TEXT_JUSTIFY_CENTER);
    cy += fy;
    // I assume you are doing something like this, but where does `text` come from?
    dc.drawText(cx, cy, font, text, Graphics.TEXT_JUSTIFY_CENTER);

    Could describe how you are getting the string that fails to draw properly?

  • sorry for the bad explanations,

    var text = "říjen"
    dc.drawText(cx, cy, font, text, Graphics.TEXT_JUSTIFY_CENTER);
    var text = Date.info(Time.now(), Time.FORMAT_LONG).month;
    dc.drawText(cx, cy, font, text, Graphics.TEXT_JUSTIFY_CENTER);

  • Seems the strings are different, though the chars may look the same.

    Try using toCharArray() on both and see what the value for each character is in both.  In your .fnt file you can just have both values pointed to the same thing in the png.

    Here's an example in the sim with the degree symbol for a 245.  The lat/lon is generated with a call to toGeoString()  and the degree symbol shows as a diamond with a ?, yet when I display the temperature using 

    var degree="°"; //utf-8, b0 hex, 176 dec

    it's fine (bottom of the screen).  This is with a native font, and I see the degree symbol on the real device in both cases.

  • many thanks,

    but is is odd, the last 8 months, no issue and now I have it (sorry can't tell from when)

    an other test I did:

    var M = "октябрь";Sys.println(M.toUpper().toUtf8Array()+"   "+M);
    var M2 = date.month;Sys.println(M2.toUpper().toUtf8Array()+"   "+M2);

    I don't have the same value at all, an utf8 code is supposed to be always the same isn't it?

    if I do the same test with M="octobre" and simulator language in French, no issue.

    It seems that the issue come from Garmin Translation.

  • On devices, in the Garmin\text folder are the translation files for languages, and the do get updated at times.

    Maybe there was a new one for a languages with alternate characters.  But with a custom font. as I said you can just do some minor editing to the .fnt file to handle them.

  • Many thanks, it is what I'm doing ! only eddit the .fnt,

    but something I don't get (probably because I'm new in dev world)

    October will always be called October

    an O will always be an O so the char code will always be the same won't it?

    So I guess it is the same for "special characters" language?

    so for exemple říjen will remain říjen and the ř will always be 345?