encode decode problem


I’m sending the following email address to the server via ajax: b@b.com

var request = $.ajax({

	url       : varUrl,

	data      : {email: $('#email').val()},

	type      : 'GET',

	dataType  : 'json',

	cache	  : false,


On the server, it is received in $_SERVER[‘REQUEST_URI’] as: b%40b.com

I tried to extract it with: Yii::app()->request->getParam() and urldecode(), but both return: "b& #8212;b.com" (remove space).

This happens when the ajax uses GET or POST.

Also note that "& #8212;" is not the html code for @. It is the html code for a dash (-).

Even if I bypass ajax and just test it on the server, I get the same result:

$c = 'b%40b.com';

$d = urldecode($c); // debugger shows it as "b& #8212;b.com"


$a = '@' // debugger shows "& #8212;"

Any ideas?

weird I just tested it this is what it outputs

<?php echo urldecode('a%40b.com') ?> // a@b.com

Hi alirz23

Yes it works when you echo() it. It displays correctly in the browser.

But when I use it in the controller - in an email address to read the user’s record - then it does not work as expected.

Please check its value in the controller with your debugger.

Okay I find that it still works right inside the controller as well - although the debugger shows the value of the ‘@’ as being ‘& #8212;’.

But it is still weird. Maybe it is just a debugger issue, because everything else looks fine.

UPDATE: It was a bug in the debugger!