views:

64

answers:

1

I have an existing project using Flex SDK 3.3 which uses a property file for all the static text in our Flex application. There's one specific tag which has a copyright symbol but it needs to be changed to the servicemark symbol. I'm aware that some fonts may not have support for the service mark.

The existing text looks like this:

header.productName = Acmeâ?¢

The text gets assigned to an mx:Text tag.

I'm now sure of is how do you get the servicesymbol into the property file? I'm not sure how/why the copyright symbol looks like that in the property file either.

TIA, Magnus

+1  A: 

The reason why you're seeing the garbled text in your properties file is likely due to a mismatched file encoding. In other words, the original file was likely created using UTF-8 or something similar that can display special marks like copyright symbols, etc. but you're now trying to view it in ASCII mode which displays the multi-byte characters as the garbled output you're seeing.

(This is purely a guess on my part, I don't know what your setup looks like)

All that aside, getting non-standard characters into your properties file and displaying them in Flex is pretty straightforward. Basically, all you need to know is the HTML or Unicode encoding of the symbol you want to display (either will work). For example, the copyright symbol (©) has an HTML encoding of © and a Unicode value of \u00A9.

What you do is use these encodings in your properties file, something like the following:

header.productName = Acme©

Then in your MXML when you define your Text element, use the htmlText property, rather than text:

<mx:Text id="myText" htmlText="{resourceManager.getString('someBundle', 'header.productName')}"/>

That should do it for you!

As a side note, if you have a lot of these special characters in your properties file, you might want to consider using a tool like native2ascii to convert them all for you.

Dan