Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Cleaning curly quotes from DCR field
jl3525
I've been trying to use FormAPI (not terribly successfully!) to clean out curly quotes from a DCR field. I can't come up with a way to define the curly quote in my script that actually works. See script:
function init()
{
IWEventRegistry.addFormHandler("onSave", onSave );
IWEventRegistry.addItemHandler("/Headline", "onItemChange", onChange);
//alert ("In Init");
}
function onSave(button)
{
alert("yeah, in save");
}
function onChange(item)
{
//alert("in onChange");
var obj,value;
obj = IWDatacapture.getItem("/Headline");
value = obj.getValue();
//value = value.replace(/curlyquote/g, "singlequote");
item.setValue( value );
alert (value);
//return true;
}
init();
I've tried all the different special character codes and such for the value. replace; still no luck. Anybody have any ideas for me?
Find more posts tagged with
Comments
MattP
which characters have you tried?
" = quotation mark
“ = left double quote
‘ = left single quote
’ = right single quote
” = right double quote
Matt
Matthew Petitjean
BOC Group
Murray Hill, NJ 07974 USA
jl3525
Thank you for the reply! I should have written down all the character codes I've tried, There have been many. I can't find one that first recognizes a curly quote and then, secondly, changes it to a straight quote. I've tried the escape \ and many different character codes including:
" = quotation mark
“ = left double quote
‘ = left single quote
’ = right single quote
” = right double quote
‘
etc.
\u8220
etc.
The tech note at:
http://devnet.interwoven.com/site.fcgi/techlib/049632
TechNote: 49632 - Title: Eliminating Certain Characters Using FormAPI
was very helpful but didn't give an example specific to curly quotes. Any other thoughts would be much appreciated! Thanks!
MattP
Can you give a little more background...
Are uses copying and pasting out of word, and you need to strip out the characters?
matt
Matthew Petitjean
BOC Group
Murray Hill, NJ 07974 USA
jl3525
Partially correct, right now folks in our Communications group collect information from all over the State of Washington which is entered into a DCR. If they miss a curly quote as they cut and paste, it crashes our headline process and index database. Information comes to them in every format you can imagine from Word, WordPerfect, text files, email files, ect.
Thanks!
MattP
OK, that makes sense. I assume they are pasting into a formatted text area. If so, there is a cleanchar attribute that may help. It would take care of the encoding so your process wouldn't barf. Check page 280 in the developmers guide.
http://www.ektron.com/software/released/ewebeditpro/v26/developerguide.pdf
IF NOT, there are perl modules that will escape characters. Look into Teamsite:
treamFilter. I use it for streaming out HTML.
That's all I can really think of....
Please post the solution for future reference if you find it.
Good Luck
Matt
Matthew Petitjean
BOC Group
Murray Hill, NJ 07974 USA
jl3525
Very nice.....I've been looking for a eWebEditPro guide. This may answer other questions about our Visual Formatter also. Thank you! I certainly will post what I come up with.
MattP
good. As much as I don't like the VFE, at least is has thorough documentation.
good luck
matt
Matthew Petitjean
BOC Group
Murray Hill, NJ 07974 USA