Unicode literals in Monkey C?

In Monkey C, is there a way to create a Unicode string in the code directly?

In other words, I'd like to display a unicode string so I'm doing something like:

var myString1 = "é";

When I display myString1, it renders as a diamond-question-mark.

However, if I load the string from XML then that renders properly.

<string id="foo">é</string>
var myString2 = Ui.loadResource(Rez.Strings.foo);


Interestingly the `hashCode` of myString1 is 67580 and myString2 is 240.

So my question then is, how can I create the exact bytes represented by `myString2` without having to load the resource?
  • We're looking into this--I agree that you should be able to use a string literal instead of using a resource in this case.
  • We identified a bug that was preventing the use of unicode literals in strings, and it's been fixed. This fix will be available in an upcoming SDK release.
  • Hi there, 

    Is there any solution to this? I'm still facing this issue, this is what I'm doing:

    SDK 7.2.1

    Code:

    var today = Gregorian.info(Time.now(), Time.FORMAT_MEDIUM);
    dateDayOfWeekLabel.setText(today.day_of_week.toString());


    Watch language: Spanish

    It should render "Mié", for Miércoles, spanish word for Wednesday but instead is comming "Mi�".



    This happens in the Simulator and in the Watch as well.

    Any suggestion on this?

    Thanks in advance.

  • I guess your watch type and the firmware version would be useful.

    I'm curious do you see the same ? in the built-in watch faces as well? What about other ciq watch faces?

    What font are you using?

    Also, what happens if you set the text to "Mié"?

  • Which device are you using in the sim and which real device?   things show correctly for me on a real 965 and va5 set for Spanish

  • Ok, here is the thing I'm using a custom Font, generated using Bitmap fornt generator, and now that I tried the suggestions of both of you, It works as expected when using Garmin fonts like Graphics.FONT_LARGE for instance. So Graphics fonts are able to understand these special characters.

    I realized that I forgot to include special characters in my generated fonts, I thought I had, but not. Rubber duck debugging at its finest! It's late, and I'm new to this, so I missed that.

    Thank you so much for your quick and helpful response. I really appreciate it.

    yes, I created the other post just in case nobody answer in this one since is very old. I'll answer in that one to redirect to this reponse. 

  • And understand that with a custom font, you could run into this same thing in different places with different languages.

    For me, if I want the proper display of something like a date, I use a standard font, or if I want to use a custom font, I use the English strings.

  • That's a valid point, and I'll take that into account. Now I know how to address this kind of situations. Thanks!

  • Another option is to display this in a way that's not language dependent.  Instead of "July 10", show it as 7-10 or 10-7 (make the format configurable)..  As far as the day of the week, be creative, and you can use System.getDeviceSettings().firstDayOfWeek, to handle places where the week starts on Saturday,  Sunday or Monday.  Maybe something like 7 dots, with the current DOW is a different color.

  • Thank you for the suggestion! That's actually a good idea of displaying dates in a non-language-dependent format and using visual indicators like dots for days of the week. I’ll definitely explore these options. An yes, your tip on using System.getDeviceSettings().firstDayOfWeek is very helpful for accommodating different week start days. I'll give it a try.

    Thanks again for your support!