9 Replies Latest reply on Aug 13, 2007 7:21 PM by zuua

    Setting button label using XML character entities (ä etc.)

    pjw-dpcp

      Hi,

      The following works in MXML, producing a button labelled "Välkommmen" (note umlaut -- two dots -- over the 'a'):
      <mx:Button id="test_button" label="V&#228;lkommen"/>

      However, when trying to set the button's label dynamically via ActionScript like this:
      var funkyLabel :String = "V&amp;#228;lkommen hos oss";
      test_button.label = funkyLabel;

      ...it HTML-entity-izes the ampersand, showing up as an ugly button label of "V&#228;lkommen hos oss".

      (Why does it matter? Because I'm retrieving the labels for buttons -- depending on user language -- via XML, and XML likes its special characters entity-ized, as in "&#228;" instead of "ä").

      Anyone have any ideas? I've tried various ways of escaping the &, googled around... no luck.
      Thanks.