View Full Version : Text changes from trace() to TextField
dalseide
February 15th, 2010, 06:11 PM
I'm loading some text from an XML.
If I use the trace() method, the output shows nordic letters (æøå), but when the text is shown on stage in a textfield, "ø" is shown correctly, but "å" becomes regular "a".
• The font supports nordic letters.
• All of the nordic letters is correctly displayed in the rest of the page I'm developing.
• embedFonts = true;
• XML is saved with UTF-8
... a shot in the dark is better than nothing at this point.
Stratboy
February 16th, 2010, 11:08 AM
are you sure you're using utf-8 NO BOM?
Also, could you post the relevant code please?
dalseide
February 16th, 2010, 05:22 PM
The AS:
songTxt = new TextField();
songTxt.antiAliasType = AntiAliasType.ADVANCED;
songTxt.defaultTextFormat = FontLibrary.SongTekstFormat;
songTxt.embedFonts = true;
songTxt.text = songtxt[ u].slice(letter, songtxt[ u].indexOf("/break"+a));
songTxt.x = txtX;
songTxt.y = 0;
if(temp.length != 0 ) {
songTxt.y = temp[ a-1]+7;
}
if(songTxt.y > 310) {
txtX = 470;
songTxt.x = txtX;
songTxt.y = 0;
}
songTxt.autoSize = TextFieldAutoSize.LEFT;
songTxt.filters = [dropFX];
Some of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<tekst>
<song>
<title>Visepsykiatri</title>
<songtxt>Eg ha møtt folk på veg opp.
Eg ha møtt folk på veg ned.
Eg ha alder stoppa opp
før eg møtte deg.
/break0 Eg ha trakka på bloma
sliti asfalten ned.
Siti sundt ein sofa
før eg møtte deg.
/break1 No må eg starta med noko
eg bi borte i
so eg slepp å tenkji på deg
visepsykiatri.
/break2 Eg ha prøvd is i magjin
eg ha prøvd med å le.
Men når eg let att augun
ser eg berre deg.
/break3 Eg ha klivi høgt te fjells
sprunge heile vegen ned
sjølv når eg er langt te skogs
ser eg berre deg.
/break4 No må eg starta med noko
eg bi borte i
so eg slepp å tenkji på deg
visepsykiatri.
/break5 Og eg må låte, som små akvarella
rosa og lyseblåe, måneskinnskvelda.
/break6 </songtxt>
</song>
Stratboy
February 17th, 2010, 02:53 AM
Try to use html text maybe:
songTxt.htmlText = yourText;
dalseide
February 17th, 2010, 01:18 PM
Nope, didn't do it.
But thanks for trying.
dalseide
February 17th, 2010, 01:30 PM
Ok, I fixed it.
Used the Find & Replace tool (I'm using Smultron, but the tool is basic in almost all text edit software). I used it to replace the letter "å" with . . . "å".
I can't explain why this worked. Some hidden coding must have followed (or not followed) when I copied the text from a PDF to the XML.
If someone could explain this I would be grateful. Would like to understand what happened here. Hope someone have use of this, sure made my day a living #$%&.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.