View Full Version : Special Characters in text
cmcginnis
03-11-2003, 03:37 PM
I'm trying to use special characters in a text element and getting a compile error. I'm trying to use the é as follows:
<canvas>
<text>S & eacute; lectionner</text>
</canvas>
(Of course without the space between the & and the eacute - I wanted it to show up as the code not the é)
And getting:
Error: specialchar.lzx:2:17: The entity "eacute" was referenced, but not declared.
How can I use special characters?
Thanks
LZX source is XML, not HTML, so you can't use HTML entity references. You can use the numeric code &#233; . You need to make sure the font you are using has that character in it also. The Laszlo default font doesn't have it (it ought to, we need to
really ship a full ISO-LATIN-1 default font), but other fonts do have it, like the Times Roman
<canvas>
<font name="Times Roman" src="timmonsr.ttf" />
<text font="Times Roman" fontsize="18" >S&#233;lectionner</text>
</canvas>
antun
03-11-2003, 04:29 PM
Alternatively just use the character é in your LZX file. :)
I've actually just been testing the method described by hqm above, and this does not appear to work with the default (LzTahoe8) font. We're looking into it. However it does work with the other (nicer) fonts we ship with, and I tested it with a TTF font that was in my Fonts folder.
In short, the only 'named' special characters in LZX are as follows:-
&quot;
'
&amp;
>
<
Everything else uses the decimal reference (e.g. é).
Take care,
Antun
jtang
03-12-2003, 01:25 AM
Hi Chris,
The LPS-DR release does in fact ship with lztahoeplus8*.ttf and lzsansplus8*.ttf, which support the extended character sets for lztahoe and lzsans. You can declare and use these fonts in your application.
We default to the simpler subsets because they're sufficient for most users, and the resource files are roughly half the size.
Congrats on the wedding!
Jerry
cmcginnis
03-12-2003, 09:45 AM
As always thanks for the quick (and plentiful) responses. We are using Univers Light and Univers Bold so the special characters are coming up in all their hyphentaed and acuteness glory.
Thanks for the congrats Jerry. I'm outta here tomorrow!
If you want to just use the extended (8-bit) characters in your source file, that ought to work if you use ISO-8859-1 (ISO-LATIN-1).
Technically, XML files should be interpreted by default as being in Unicode UTF-8 encoding, which differs slightly from ISO-8859-1 for some range of single byte character values. However, when you run the Laszlo compiler, I think it currently reads in the .lzx files using the Java system default encoding, which is usually ISO-8859-1 on most systems (for example, if you're in Japan, it might be Shift-JIS, I'm not sure).
When the compiler writes out the text strings to Flash, it uses the CP1252 character set encoding (which is Microsoft's own 'special' version of ISO-8859-1, and which Macromedia Flash 5 supports). So if you used some magic Microsoft characters, it is possible they won't make it through this pathway. But most ISO-8859-1 characters should just work.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.