473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Strange behaviour with ' char

[Correction about previous]

Hi. I found a strange behaviour I cannot explain with the ' char. I do
the following:

1) there is a string with ' inside.
2) I encode the string with urlencode, I put it in a $_GET['arg']
variable
3) in the next page (pointed by the link that included the arg param),
I do $str=urldecode($_GET['arg'])

... then ' comes out as \' ! (?)

Why? In the url arg contains %27 instead of ' ... The thing happens
*even if* I don't use urldecode :O :|

I think there is some processing done by _GET handling but I can't
find anything about this... Plese help :)

bye

Oct 29 '07 #1
3 1662
On Oct 29, 11:58 am, "Gotch@" <dario...@gmail.comwrote:
[Correction about previous]

Hi. I found a strange behaviour I cannot explain with the ' char. I do
the following:

1) there is a string with ' inside.
2) I encode the string with urlencode, I put it in a $_GET['arg']
variable
3) in the next page (pointed by the link that included the arg param),
I do $str=urldecode($_GET['arg'])

.. then ' comes out as \' ! (?)

Why? In the url arg contains %27 instead of ' ... The thing happens
*even if* I don't use urldecode :O :|

I think there is some processing done by _GET handling but I can't
find anything about this... Plese help :)
magic_qoutes_gpc, disable it, or it you can't, use this:

$arg = get_magic_quotes_gpc() ? stripslashes($_GET['arg']) :
$_GET['arg'];

Oct 29 '07 #2
Gotch@ wrote:
[Correction about previous]

Hi. I found a strange behaviour I cannot explain with the ' char. I do
the following:

1) there is a string with ' inside.
2) I encode the string with urlencode, I put it in a $_GET['arg']
variable
3) in the next page (pointed by the link that included the arg param),
I do $str=urldecode($_GET['arg'])

.. then ' comes out as \' ! (?)

Why? In the url arg contains %27 instead of ' ... The thing happens
*even if* I don't use urldecode :O :|

I think there is some processing done by _GET handling but I can't
find anything about this... Plese help :)

bye

Your server has magic_quotes_gpc enabled.

If this is your server, I'd recommend you disable it. If it's a shared
server, you can disable it in the .htaccess file, but quite frankly, I'd
recommend you find a different host.

To get around your immediate problem, you can use stripslashes() to
remove the slashes, and get_magic_quotes_gpc() to see if the flag is on
or off.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 29 '07 #3
Tnx to everybody... I can't change my host, but stripcslashes is doing
the job just fine.

Bye :)

On 29 Ott, 11:58, "Gotch@" <dario...@gmail.comwrote:
[Correction about previous]

Hi. I found a strange behaviour I cannot explain with the ' char. I do
the following:

1) there is a string with ' inside.
2) I encode the string with urlencode, I put it in a $_GET['arg']
variable
3) in the next page (pointed by the link that included the arg param),
I do $str=urldecode($_GET['arg'])

.. then ' comes out as \' ! (?)

Why? In the url arg contains %27 instead of ' ... The thing happens
*even if* I don't use urldecode :O :|

I think there is some processing done by _GET handling but I can't
find anything about this... Plese help :)

bye

Oct 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frank Passek | last post by:
Dear all, I've encountered some strange behaviour with PHP (4.3.2) using the CLI-API. When I provide an option in the first line of my script like so: #!/usr/bin/php -c /path_to_my_ini_file and...
16
by: Dario de Judicibus | last post by:
I'm getting crazy. Look at this code: #include <string.h> #include <stdio.h> #include <iostream.h> using namespace std ; char ini_code = {0xFF, 0xFE} ; char line_sep = {0x20, 0x28} ;
3
by: Bruno van Dooren | last post by:
Hi All, i have some (3) different weird pointer problems that have me stumped. i suspect that the compiler behavior is correct because gcc shows the same results. ...
6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
2
by: shaun roe | last post by:
Following up from my earlier post, where I pursued the line I outlined. Here is the MYFunc class implementation: MyFunc::MyFunc(int i):m_i(i){ ostringstream os; os<<"This number is "<<m_i;...
8
by: manochavishal | last post by:
Hi, I have a structure MAX_ID is 5 /**Structure for Copies*/ typedef struct NodeVideoCopy * NodeVideoCopyPtr ; typedef struct NodeVideoCopy {
31
by: gamehack | last post by:
Hi all, I've been testing out a small function and surprisingly it does not work okay. Here's the full code listing: #include "stdlib.h" #include "stdio.h" char* escaped_byte_cstr_ref(char...
23
by: gribouille | last post by:
Hi, via fgets() i create a array containing a text file. fp = fopen(argv, "r"); while ((c = fgetc(fp)) != EOF) { line = c; when i want to print it
8
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: ...
20
by: Pilcrow | last post by:
This behavior seems very strange to me, but I imagine that someone will be able to 'explain' it in terms of the famous C standard. -------------------- code -----------------------------------...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.