Escaping slashes
#1

Hi,

I see if i escape Backslash (\) i get 2 \\ and more more time player get saved it's get doubled slashes

https://sampwiki.blast.hk/wroot/index.ph...&printable=yes

Maybe possible when loading disable slashes what i have escaped?
Reply
#2

Does the \\ appear in the saved file? If yes you're doing something wrong.

You only have to escape them when you actually type it in a string or as a single character (like '\\') in your script.
If you load a "\" from a text file for example (or a player writes a backslash in a dialog), it is already escaped.

If I got your question wrong, please explain it a bit more.
Reply
#3

Yes \\ apear not \\ i see like that

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\

When player disconnect i save everytime info like all peoples safe, and i safe messages (PM) i use escape everytime before use mysql query to safe and when connect i load.
Reply
#4

Other question if can i escape a lot of times in a sec. ?
Reply
#5

Oh I thought you were working with files.

Whats your exact query to set the text containing a backslash?

Usually the backslash has to be escaped for a query in cleartext, so if you write the backslash in PAWN you have to make it \\\\. If you already have a backslash in a text you have to insert another \ ("\\" in PAWN). But I don't know if mysql_escape_* already does this, if yes don't escape twice.

You can also un-escape it everytime you load a string containing double backslash using for and strdel.

But I'm not very pro at MySQL, so you might want to wait for someone else to give their opinion or ****** it (it has been asked like a hundred times on stackoverflow with good solutions).
Reply
#6

Yes i too think that i need delete half of this "\" with strdel
Reply
#7

There should be a way without doing this though, seems more like a workaround.
You can try NO_BACKSLASH_ESCAPES SQL or changing the queries.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)