Skip to main content
Inspiring
October 4, 2013
Answered

flash changes apostrophe to question mark when saving data?

  • October 4, 2013
  • 1 reply
  • 972 views

Hi,

Ok these are the steps I take to create the problem within my Flash application.

1. Copy and paste a string from a word.doc which contains an apostrophe

2. I then save this data to a XML doc.

3. reload that XML data, now the apostrophe has changed to a square box

4. I then resave this data

5. I reload this data and now, the square box has changed to a question mark.

My question is, how do I stop this from happening other than not copying from a word doc?

Is there something extra I have to do when parsing the string into its saved format.

Currently what happens is:

1. Pass the string from the input box to an object

localTextObject.textData = myInput.text

2. The object is then parsed through a custom Object to XML parser

for example:

textNode.text = "";

textNode.text.appendChild( localTextObject.textData );

3. And then an XML file is saved local with this data in it.

Does Flash do something wonderful along the way as so by the third time around we have gone from a speech mark to a question mark?

Any help with solving this problem would be very much appreciated.

Thanks

This topic has been closed for replies.
Correct answer

Apostrophes from word aren't part of the normal ASCII character set. They've been mucking up plain text forever...

You can use a RegEx to strip them out, or just change them to regular apostrophes. Something like so should work:

reg = new RegExp("“", "gi");

m = m.replace(reg, "");

1 reply

Correct answer
October 4, 2013

Apostrophes from word aren't part of the normal ASCII character set. They've been mucking up plain text forever...

You can use a RegEx to strip them out, or just change them to regular apostrophes. Something like so should work:

reg = new RegExp("“", "gi");

m = m.replace(reg, "");

DazFazAuthor
Inspiring
October 6, 2013

Hi dmeN,

Thats a prefect solution and thank you.