Acknowledged

utf-8 and string resources

i have a problem with german umlauts (öäü) in string resources:

whenever i get the app from the ciq store (iq file) i only get "?" instead of umlauts while it works fine when i sideload the app or test in the simulator.

this happened before (see https://forums.garmin.com/developer/connect-iq/i/bug-reports/connect-mobile-and-utf-8-for-app-settings) and seemed to be fixed with SDK 3.2.3 but now using SDK 4.1.7 it re- appeared...

  • im using cmake to build - carrying around the setup from ciq version 1.something.

    i changed the macro used for the pkg builds to to use "monkeyc" a while back to try it (wasnt available form the beginning iirc) but not the one used for the .iq build...

    -f was always there but not the java options defined in "monkeyc". if you build with eclipse or vscode everything should be fine

  • Do you build app using yours own script and you have forgotten to add -f?

    Or eclipse plugin doesn't add this option when iq compiles and everybody have to add it?

  • now i finally made it work :-)

    i was using something like

    java -jar monkeybrains.jar -f monkey.jungle -y my_key -o myApp.iq -e -w -r

    to build the iq file - if i use

    monkeyc -f ...

    it is working as expected.

    a look into the "monkeyc" script reveals it is using the "-Dfile.encoding=UTF-8" java option which when missing causes the problem described here.

    thx everyone for helping.

    @Garmin: please mark this as solved as i cant...

  • 23:30 /home/tobi/git/garmin/umlautTest ;-) file source/umlautTest.mc resources/layout.xml resources/strings.xml 
    source/umlautTest.mc:  Java source, Unicode text, UTF-8 text
    resources/layout.xml:  Unicode text, UTF-8 text
    resources/strings.xml: Unicode text, UTF-8 text
    

  • since i still cant seem to figure this out i put together a very simple test app and it show i was wrong about this being related to string resources - i also get "?" for all umlauts coming from inside the app (layout.xml, strings.xml or a source file).

    Here the code:

    using Toybox.Application;
    using Toybox.WatchUi;
    using Toybox.Graphics as Graphics;
    import Toybox.Lang;
    
    class umlautTestApp extends Application.AppBase {
        function initialize() {
            AppBase.initialize();
        }
        function getInitialView() {
            return [ new umlautView(), new WatchUi.BehaviorDelegate() ];
        }
    
    }
    
    class umlautView extends WatchUi.View {
        function initialize() {
            View.initialize();
        }
        function onLayout(dc) {
            setLayout(Rez.Layouts.MainLayout(dc));
        }
        function onUpdate(dc) {
            (View.findDrawableById("text3") as WatchUi.TextArea).setText("ÄÖÜäöü");
            View.onUpdate(dc);
        }
    }
    

    <layout id="MainLayout">
     <label id="text1" x="center" y="30%" color="Graphics.COLOR_RED" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_SYSTEM_SMALL" text="@Strings.umlaut" />
     <label id="text2" x="center" y="50%" color="Graphics.COLOR_GREEN" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_SYSTEM_SMALL" text="ÄÖÜäöü" />
     <label id="text3" x="center" y="70%" color="Graphics.COLOR_BLUE" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_SYSTEM_SMALL" text="" />
    </layout>⏎                 

    <strings>
        <string id="AppName">umlautTest</string>
        <string id="umlaut">Rez: äöüÄÖÜ</string>
    </strings>

    This still works fine for the sideloaded .prg and in the simulator but if i install the app from ciq store (beta so far but i can publish if anyone is interested...) i get "?" for the umlauts in all 3 text fields.