Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Replacing smart quotes from word

We currently have a function to cleanup a string of XML data, so far its been working great, but a couple of clients are copy/pasting their text from word, and word has 'smart quotes' which seem to be different than regular quotes.  How can I add code to the function so that it converts those quotes into  '   just like it does with regular quotes ?

function clean( str )
    if str <> "" and not isNull( str ) then
        str = Replace( str, "<", "" )
        str = Replace( str, ">", "" )
        str = Replace( str, "&", "&amp;" )
	str = Replace( str, "'", "&apos;" )
        str = Replace( str, "&quot;", "\""" ) 
	str = Replace( str, "&amp;apos;", "'" )
    end if                
    clean = str
end function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Are there any other smart characters in word?
Avatar of Aleks

ASKER

Cool !
as far as I know, those are the ones that'll give you problems.

as for your other question, can't use the same function to "clean" values before you do an insert?
Avatar of Aleks

ASKER

I think we can. I added it to my include files, but how do I apply it to the insert statement above ?

Do I need to add it to each field ?

  MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 201, 1, -1, Request.Form("JobDesc")) ' adLongVarChar

If so, what would the syntax be for the above line ?

I already have the function in my include files.
i answered in the other question
Avatar of Aleks

ASKER

Thanks!