Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing quotes? 2

Status
Not open for further replies.

kelani

MIS
Nov 29, 2000
44
0
0
US
I currently have this code in palce to rpelace CRs and LFs and need to replace Quotes:

&quot;#chr(13)##chr(10)#&quot;, &quot;<br>&quot;, &quot;all&quot;

I tried adding a chr(34) but it doesn't work, and screws up the insert query. Any reason why this wouldn't work?

&quot;#chr(34)##chr(13)##chr(10)#&quot;, &quot;&quot;&quot;, &quot;<br>&quot;, &quot;all&quot;

Thanks,

kelani The Land of Broken Dreams 9 -
9.1 million visitors since 1992
Register today, and get sexy.
 
Kelani,

I don't know why but in your second code line with the CHR(34) you added ,&quot;&quot;&quot; , in your code line what doesn't belong in the command.
This means you added an extra parameter to the replace command which doesn't exsist.
 
Actually I use ampersand - quote - semicolon, but Tek-tips changed it to a quote. argh :) The Land of Broken Dreams 9 -
9.1 million visitors since 1992
Register today, and get sexy.
 
Hey Kelani,

It sounds like you are using the replace function inside a query. If so, can you post the code for your cfquery so I can see the context in which you're using it?

Also, can you give an example of what you're trying to change as that would only affect lines that end in a quotation and wouldn't affect all other lines. This means that only lines ending in a quote would get converted to the &quot;<br>&quot; syntax. I'm guessing you really want to change the CRLF sequences into &quot;<br>&quot;s and also change quotes into &quot;<br>&quot;s. Let me know if this is the case.

GJ
 
Actually, I'm not.

Basically, I have CRs and LFs converted (this is a web email box) My problem is I'm getting an invalid buffer error when people include quotes in their messages, so I need to convert them to amp-quote-semicolons Here's my code: without the quote conversion. it's not inside the query.

<cfset form.data=replace(data, &quot;#chr(13)##chr(10)#&quot;, &quot;<br>&quot;, &quot;all&quot;)>

<cfquery name=&quot;sendmail&quot; dbinfo>
INSERT INTO mail (mid, data, new, sendname, sender, recip, subj, sent, recipname) VALUES ('', '#form.data#', '1', '#form.sendname#', '#form.sender#', '#form.recip#', '#form.subj#', '#DateTime#', '#form.recipname#')


etc... etc.. :)

problem is, adding a conversion of the quotes doesn't work. Everything else seems to, including changing alphanumerica into copyright symbols and stuff :)

Thanks in advance

Kelani The Land of Broken Dreams 9 -
9.1 million visitors since 1992
Register today, and get sexy.
 
Hey Kelani,

What happens if you do this?

<cfset form.data=replace(data, &quot;#chr(13)##chr(10)#&quot;, &quot;<br>&quot;,&quot;all&quot;)>
<cfset form.data=replace(data, &quot;#chr(34)#&quot;, &quot;&amp;quot;&quot;,&quot;all&quot;)>

<cfquery ....

If it doesn't work right, let me know exactly what the problem is. i.e. does the insert generate a CF error, does it insert but only insert data up to the quote, etc..

GJ

 
Actually, one more thing. How do you replace it if it's inside a query? The Land of Broken Dreams 9 -
9.1 million visitors since 1992
Register today, and get sexy.
 
Is this what your looking for?

<cfquery....
select * from tableName
where field1 = '#replace(replace(form.var1,&quot;#chr(13)##chr(10)#&quot;,&quot;<br>&quot;,&quot;all&quot;),chr(34),&quot;&amp;quot;&quot;,&quot;all&quot;)#'

</cfquery>
 
Both examples worked great. Thanks so much for the help, I voted for all of you :) The Land of Broken Dreams 9 -
9.1 million visitors since 1992
Register today, and get sexy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top