Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / December 2005



Tip: Looking for answers? Try searching our database.

More about Chr(34) and Chr(39)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam_G2 - 28 Dec 2005 11:35 GMT
Hello, my problem is the following:
   A Store send me a *.txt file with content to add to Data base.
   Format of the file:          line1)                   =>  
"COL1";"COL2";"COLn"
                                             line2 and more)=>  
"data1";"data2";"dataN"
Ok, I want format these lines for insert it into a query, everythings well, no
problem, but...
but in the second line and following I have to change the " character for '
character,
the normal actuation would be this: replace(line,"#chr(34)#","#chr(39)#","all")
but this have a strange behavior: change the " char for two ' chars.
If you try to change the " char for something other char the result is ok, but
with the ' char there isn't way :(.

Please, if this issue is solved in other place give me the link, else give me
the answer :) or give me
comments about.

Greets.
BKBK - 28 Dec 2005 14:44 GMT
The function XMLFormat() will escape the single-quotation mark (') with '  
and the double-quotation mark (") with ' .  Therefore, doing something like
this will avoid any confusion:

<cfset line = Replace(XMLFormat(line), "'", "&apos;", "all")>

 
Sam_G2 - 29 Dec 2005 14:08 GMT
Thanks  BKBK, in my own case that solution don't work, but I have considered
more options and finally I found the solution:

-The problem was that I assign the value returned by 'replace' function into a
variable and I don?t know why when I display the value of that variable show
two apos instead of only one.

-I have used the result of the function directly where I wan instead of into a
variable, of this way work, but you have to do that 'replace' the last.

It isn't the best way, but work. I continue with the doub, but the moment I
don't go to worry more.

Thank other time.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.