PDA

View Full Version : problem with JS automatically escaping characters


Darksbane
12-14-2002, 03:03 PM
Situation: I have a list of choices in select boxes for my users which allows them to write out a text file of what they chose. This text file can then be processed and used by another program with which I am not involved.

The problem: Any choice I have which has a ' in it automatically has an escape character inserted into it when I append it to the text string to be downloaded. This causes the other program to not be able to recognize the data (in it's representation of the data it is seeing something\'s instead of something's).

Is there any way I can prevent the \ from being saved? I am sure it happens when I append the info to the text string but I don't know of a way to prevent this.

Any help is appreciated

krycek
12-14-2002, 03:14 PM
well, it depends where you want to parse the data. It would appear pointless to parse it in JS, on the client-side, because you are gonna have to send that data one way or another, and hence you need the slash.

Therefore you are better off using whatever server-side language you are using, for instance in php you simply use the strip_slashes function.

So, depending on your method, you may be better off in one of the server-side forums :)

::] krycek [::

joh6nn
12-14-2002, 05:16 PM
i find that it's always easier to give an answer, when i can see the code.

whammy
12-15-2002, 05:34 AM
I would also think that the escape characters would need to be parsed out by whoever is processing the data - but how are they getting data using javascript? It cannot write to a text file.