Solved

Flex RichTextEditor

Posted on 2011-02-22
18
784 Views
Last Modified: 2012-06-21
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
Comment
Question by:myBlueSky
  • 10
  • 8
18 Comments
 
LVL 17

Assisted Solution

by:deepanjandas
deepanjandas earned 500 total points
ID: 34950421
This url may be helpful for you:

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

Warm Regards
Deepanjan Das
0
 
LVL 1

Author Comment

by:myBlueSky
ID: 34950527
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
 
LVL 1

Author Comment

by:myBlueSky
ID: 34950607
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
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34951053
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
 
LVL 1

Author Comment

by:myBlueSky
ID: 34951069
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
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34951182
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
 
LVL 1

Author Comment

by:myBlueSky
ID: 34953051
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
 
LVL 17

Assisted Solution

by:deepanjandas
deepanjandas earned 500 total points
ID: 34953081
Then try this:

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

Warm Regards
Deepanjan Das
0
 
LVL 1

Author Comment

by:myBlueSky
ID: 34953205
What about the replacement?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:myBlueSky
ID: 34953429
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
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34957578
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
 
LVL 1

Author Comment

by:myBlueSky
ID: 34957727
I didn't work using RegEx. it is working with myStr = myStr.split("'").join("");

How can we do it using RegEx?
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34957769
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
 
LVL 1

Author Comment

by:myBlueSky
ID: 34957868
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
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 34961062
Try this:
var myRegExp = new RegExp("’","g");
str = str.replace(myRegExp, "");

Open in new window


Warm Regards
Deepanjan Das
0
 
LVL 1

Author Closing Comment

by:myBlueSky
ID: 34961095
Thanks Deepanjan Das for your valuable support.
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34961138
Did it work?

Warm Regards
Deepanjan Das
0
 
LVL 1

Author Comment

by:myBlueSky
ID: 34991539
Overall is OK. Thanks Deepanjan.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now