Skip to main content
Participant
July 20, 2006
Answered

importing special characters from text file

  • July 20, 2006
  • 3 replies
  • 389 views
My project requires me to import a text file into a dynamic text field by using the loadVariables() function. My problem is that the text file contains a ampersign "&" . It seems that the ampersign stops the rest of the text from being imported into my flash movie. Is there a special character or escape character that I can use to allow me to import the ampersign?

I've tried using the & and setting my dynamic text field to HTML. No luck. Oh.. I'm using flash MX :(

Any ideas?
This topic has been closed for replies.
Correct answer parker7211986
I found a link that helps:

http://www.adobe.com/cfusion/knowledgebase/index.cfm?event=view&id=KC.tn_14143&extid=tn_14143&dialogID=33731379&iterationID=1&sessionID=4830136b611e54860724&stateID=0+0+33735653&mode=simple

Example: & is equivlant to %26

Works for me!
Thanks for your suggestions.

3 replies

kglad
Community Expert
Community Expert
July 22, 2006
you're welcome (and that's url-encoding).
Participating Frequently
July 20, 2006
Hey I've run into this problem and found the solution lies with JavaScript which can read the text just fine and then parse it back to Flash as escape characters:

//JavaScript code:
var origText = 'blah blah & then i did this & then blah blah";

var newText = String(escape(origText).replace(new RegExp('\\+', 'g'), '%2b'));
FlashWin.sendText(newText); // << this is a reference to a flash window with ExternalInterface enabled

// end

However, I was using HttpRequest in JS to get my original data. So this method is dependent on something other than Flash to retrieve the original text (with ampersands).

I really hope they fix this bug in the future, it can drive you nuts....

-Dan

parker7211986AuthorCorrect answer
Participant
July 20, 2006
kglad
Community Expert
Community Expert
July 20, 2006
yes, url-encode your characters: http://www.albionresearch.com/misc/urlencode.php