473,473 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1665
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.