Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 805
  • Last Modified:

Flex RichTextEditor

Special characters like apostrophes (’) in Flex RichTextEditor are not recognized when you we copied text from MS Word to the a RichTextEditor and the characters get converted into sign (#) when we tried to store RichTextEditor’s html code .
0
myBlueSky
Asked:
myBlueSky
  • 10
  • 8
3 Solutions
 
deepanjandasCommented:
This url may be helpful for you:

http://blog.flashweb.org/archives/7

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
Thanks deepanjandas,

I did that before and I tried to replace all special characters like apostrophes (’) and double quotation at once from html string. Please advice.
0
 
myBlueSkyAuthor Commented:
I tried to replace the characters  but didn’t work
      myStr = myStr.replace(/"’"/g, "'");
      myStr = myStr.replace(/"‘"/g, "'");
      myStr = myStr.replace(/"“"/g, '"');
      myStr = myStr.replace(/"“"/g, '"');
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
deepanjandasCommented:
When you copy a apostrophe from word and paste it in editor, it fails to understand the character and thinks it to be an an unknown one.

Hence it sets a # or sometimes something like a block.

But if you paste that text in notepad and then paste it in editor, you will see that it works correctly.

So it may be difficult to replace the apostrophe as you have done, because, the apostrophe is actually a junk character for the editor.

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
I agree with you when you paste that text in notepad and then paste it in editor it will work. There is no way to replace all apostrophe to something recognizable. Can we do replace all for that characters?
0
 
deepanjandasCommented:
The said character is accepted as a junk one by the editor, so it is hard to track that when you paste from word.

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
I was able to repalce one character in the one statment using replace function. I want to do it for all characters (apostrophe) in the text.
0
 
deepanjandasCommented:
Then try this:

 myStr = myStr.split("'").join("");

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
What about the replacement?
0
 
myBlueSkyAuthor Commented:
I think  myStr = myStr.split("'").join(""); will work partially unless we track all characters that are recognized by RichTextEditor which is will be hard as you mentioned specially if you paste from word and apostrophe or other character differs from font to another.
Please advise on that.

Thanks for your valuable cooperation
0
 
deepanjandasCommented:
Then what you have done in ID:34950607 is good by using RegEx.
So I atleast see no options to do that for these junk characters.


Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
I didn't work using RegEx. it is working with myStr = myStr.split("'").join("");

How can we do it using RegEx?
0
 
deepanjandasCommented:
RegEx is the one you used with replace.
Its the pattern that you defined in the first argument of replace method.

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
I did it but wasn't work. I could defined wrong patter. Check it please

     myStr = myStr.replace(/"’"/g, "'");
      myStr = myStr.replace(/"‘"/g, "'");
      myStr = myStr.replace(/"“"/g, '"');
      myStr = myStr.replace(/"“"/g, '"');
0
 
deepanjandasCommented:
Try this:
var myRegExp = new RegExp("’","g");
str = str.replace(myRegExp, "");

Open in new window


Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
Thanks Deepanjan Das for your valuable support.
0
 
deepanjandasCommented:
Did it work?

Warm Regards
Deepanjan Das
0
 
myBlueSkyAuthor Commented:
Overall is OK. Thanks Deepanjan.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 10
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now