How does &lang turn to 〈 ???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ron_j_m
Forum Commoner
Posts: 35
Joined: Wed Feb 02, 2005 8:56 pm

How does &lang turn to 〈 ???

Post by ron_j_m »

I have this "&lang" in a url i am passing and when echoed out it turns into" 〈"
Im sure thats probably what its supposed to do, but I need it to stop. Any Ideas?
example

Code: Select all

$data = ("test=yes&lang=us");
echo $data;

Code: Select all

//returns    test=yes〈=us
Any Ideas?
And why?
Thanks again..
Wrench
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

you might need to escape the & sign. try \&
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try single quotes
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

singles quotes would probably do it as well:)
ron_j_m
Forum Commoner
Posts: 35
Joined: Wed Feb 02, 2005 8:56 pm

Post by ron_j_m »

man you guys are quick.
Ive tried escaping it and single quotes with no luck..
example

Code: Select all

$data = ('test=yes&lang=us');
echo $data;

Code: Select all

//returns test=yes〈=us

Code: Select all

$data = ('test=yes\&lang=us');
echo $data;

Code: Select all

// returns test=yes\〈=us
any other ideas??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

oh.. I see what's happening.. use & instead of &
ron_j_m
Forum Commoner
Posts: 35
Joined: Wed Feb 02, 2005 8:56 pm

Post by ron_j_m »

works perferct, thanks feyd.

I also found another work around usng htmlspecialchars() but not as clean as what you sugested..
Anyone know of a site that has all these special characters listed in one nice convenient spot?
Thanks again.


Wrench
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Depends upon which charset you use:

http://www.htmlhelp.com/reference/html40/entities/
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

If you're on Windows, use DzSoft PHP Editor. it has a list of the most common used HTML special characters.
ron_j_m
Forum Commoner
Posts: 35
Joined: Wed Feb 02, 2005 8:56 pm

Post by ron_j_m »

Thanks thats what I was lookin for.

Wrench
Post Reply