Can I add comments via e-mail?
htmlentities problem
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Content Management System > htmlentities problem 23 December 2009 06:57:57

  Top users: 
  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

htmlentities problem

Rob Brandt 8 October 2002 03:26:23
 Excuse the modules-related question, but all the 'smart people' seem
to be on this list now :')

I'm working on a module that needs to redirect the user to another
web site. Yahoo maps, to be specific. The url contains an address,
and yahoo maps is choking on "funny" characters in the address. It's
actually works OK if things like spaces and "#"'s are converted to
entities, so I'm trying to do that but it's not working.

I have:

$addrentities =htmlentities($addr­ess);

but the characters in $addrentities are not converted.

Anyone know why? Am I using this function wrong or should I be using
a different function?

Thanks

Add comment
J. Cox 8 October 2002 03:35:22 permanent link ]
 "Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org> wrote in message
news:mailman.103403­6881.15843.xaraya_pu­blic-dev-n5IRV0TL0hw­RxVAL8JNkP+OyGI2DFzL­e@public.gmane.org> Excuse the modules-related question, but all the 'smart people' seem> to be on this list now :')>
I'm working on a module that needs to redirect the user to another> web site. Yahoo maps, to be specific. The url contains an address,> and yahoo maps is choking on "funny" characters in the address. It's> actually works OK if things like spaces and "#"'s are converted to> entities, so I'm trying to do that but it's not working.>

Just as a cursory look at your question (perhaps this will work, perhaps it
won't, not sure what the output you are getting is;) you may want to use
htmlspecialcharacte­rs instead that htmlentities.

http://www.php.net/­manual/en/function.h­tmlspecialchars.php

If that doesn't work, could you include the output as an example so we can
see what it is dieing on. I'm not as smart as some (most) of the others,
and I kinda need to play with the outputs from time to time.



Add comment
Rob Brandt 8 October 2002 04:01:18 permanent link ]
 Actually, htmlspecialcharacte­rs was what I thought I needed at first,
but the php docs says that it only converts quotes, ampersands and
less than greater than to entities. It's for handling html tags for
the most part. htmlentities is supposed to convert all non
alphanumeric characters.

OK, here's the address I'm using. It's my address, so you all are
going to have to promise not to ring my doorbell at night :')

The string I'm starting out with is "1220 Coast Village Road #206". When I do

$addrentities = htmlentities("1220 Coast Village Road #206");

and then look at the value of $addrentities it is still "1220 Coast
Village Road #206". For this particular address, at the bare minimum
Yahoo needs the # converted to an entity. Converting all of the
spaces will make it more reliable. Converting any non alphanumeric
will be best, since end users will tend to put all kinds of stuff
into addresses. Yahoo seems to handle all the garbage in an address
pretty well if they're entities.

"Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org> wrote in message>news:mailma­n.1034036881.15843.x­araya_public-dev-n5I­RV0TL0hwRxVAL8JNkP+O­yGI2DFzLe@public.gma­ne.org>> Excuse the modules-related question, but all the 'smart people' seem>> to be on this list now :')>>
I'm working on a module that needs to redirect the user to another>> web site. Yahoo maps, to be specific. The url contains an address,>> and yahoo maps is choking on "funny" characters in the address. It's>> actually works OK if things like spaces and "#"'s are converted to>> entities, so I'm trying to do that but it's not working.>>
Just as a cursory look at your question (perhaps this will work, perhaps it>won't, not sure what the output you are getting is;) you may want to use>htmlspecialchar­acters instead that htmlentities.>
If that doesn't work, could you include the output as an example so we can>see what it is dieing on. I'm not as smart as some (most) of the others,>and I kinda need to play with the outputs from time to time.

Add comment
J. Cox 8 October 2002 04:23:05 permanent link ]
 "Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org> wrote in message
news:mailman.103403­8981.17438.xaraya_pu­blic-dev-n5IRV0TL0hw­RxVAL8JNkP+OyGI2DFzL­e@public.gmane.org> Actually, htmlspecialcharacte­rs was what I thought I needed at first,> but the php docs says that it only converts quotes, ampersands and> less than greater than to entities. It's for handling html tags for> the most part. htmlentities is supposed to convert all non> alphanumeric characters.

Gotcha.

In addition to the htmlentites, try adding this:

$addrentities =str_replace("#", "%23", $addrentities);

Because the yahoo string is replacing the # with %23 (not sure if that is an
official entity or not). That should convert the # sign as well as the
entities. I have never tried to replace a space before, but it might be
worth a shot to try to replace it with a + sign as well.

My syntax might be off a bit, because my skills are getting rusty, but it
should be able to get you started I would think.



Add comment
Jason Judge 8 October 2002 04:23:45 permanent link ]
 Have you tried the urlencode function? It will do half the job for you.

-- Jason


----- Original Message -----
From: "Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org>
To: <xaraya_public-dev-­n5IRV0TL0hwRxVAL8JNk­Pw@public.gmane.org>­
Sent: Tuesday, October 08, 2002 2:01 AM
Subject: Re: [Xaraya_public-dev] htmlentities problem

Actually, htmlspecialcharacte­rs was what I thought I needed at first,> but the php docs says that it only converts quotes, ampersands and> less than greater than to entities. It's for handling html tags for> the most part. htmlentities is supposed to convert all non> alphanumeric characters.>
OK, here's the address I'm using. It's my address, so you all are> going to have to promise not to ring my doorbell at night :')>
The string I'm starting out with is "1220 Coast Village Road #206". When
I do>
$addrentities = htmlentities("1220 Coast Village Road #206");>
and then look at the value of $addrentities it is still "1220 Coast> Village Road #206". For this particular address, at the bare minimum> Yahoo needs the # converted to an entity. Converting all of the> spaces will make it more reliable. Converting any non alphanumeric> will be best, since end users will tend to put all kinds of stuff> into addresses. Yahoo seems to handle all the garbage in an address> pretty well if they're entities.>
"Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org> wrote in message> >news:mailman.10340­36881.15843.xaraya_p­ublic-dev-n5IRV0TL0h­wRxVAL8JNkP+OyGI2DFz­Le@public.gmane.org>­ >> Excuse the modules-related question, but all the 'smart people' seem> >> to be on this list now :')> >>
I'm working on a module that needs to redirect the user to another> >> web site. Yahoo maps, to be specific. The url contains an address,> >> and yahoo maps is choking on "funny" characters in the address. It's> >> actually works OK if things like spaces and "#"'s are converted to> >> entities, so I'm trying to do that but it's not working.> >>
Just as a cursory look at your question (perhaps this will work, perhaps
won't, not sure what the output you are getting is;) you may want to use> >htmlspecialcharact­ers instead that htmlentities.> >
If that doesn't work, could you include the output as an example so we
see what it is dieing on. I'm not as smart as some (most) of the others,> >and I kinda need to play with the outputs from time to time.> ___________________­____________________­________> Xaraya_public-dev mailing list> Xaraya_public-dev-n­5IRV0TL0hwRxVAL8JNkP­w@public.gmane.org> http://lists.xaraya­.com/mailman/listinf­o/xaraya_public-dev>­


Add comment
J. Cox 8 October 2002 04:27:48 permanent link ]
 "Jason Judge" <jason.judge-LWM1r6­xbH6sqdlJmJB21zg@pub­lic.gmane.org> wrote in message
news:mailman.103404­0062.18301.xaraya_pu­blic-dev-n5IRV0TL0hw­RxVAL8JNkP+OyGI2DFzL­e@public.gmane.org> Have you tried the urlencode function? It will do half the job for you.

heh, that is probably why I have never tried converting a space before;) I
need to go back to drinking. At least I would have an excuse when I am
dense;)

http://www.php.net/­manual/en/function.u­rlencode.php



Add comment
Mikespub 8 October 2002 04:28:17 permanent link ]
 In article <antc2p$i2k$1-FogME­Os31dotat4ziPANHlKoq­+OfwspIAL8bYrjMMd8@p­ublic.gmane.org>, "J. Cox" <admin@dinerminor.c­om> wrote:>...>$addrent­ities =str_replace("#", "%23", $addrentities);>
Because the yahoo string is replacing the # with %23 (not sure if that is an>official entity or not). That should convert the # sign as well as the>entities. I have never tried to replace a space before, but it might be>worth a shot to try to replace it with a + sign as well.

That's not htmlentities you're showing, it's URL encoding - totally
different animals, living in a different place. :-)­

So if that's what Yahoo needs, you should use urlencode(...) or
rawurlencode(...).

Mike

Add comment
Rob Brandt 8 October 2002 04:34:27 permanent link ]
 That's what I was looking for! Thanks, it works. Even though it
doesn't convert the # sign, once all the spaces are +'s the browser
converted the # so that it would work. I'll test it with different
browsers tomorrow to make sure it's reliable.

Have you tried the urlencode function? It will do half the job for you.>
-- Jason>
----- Original Message ----->From: "Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org>>To: <xaraya_public-dev-­n5IRV0TL0hwRxVAL8JNk­Pw@public.gmane.org>­>Sent: Tuesday, October 08, 2002 2:01 AM>Subject: Re: [Xaraya_public-dev] htmlentities problem>
Actually, htmlspecialcharacte­rs was what I thought I needed at first,>> but the php docs says that it only converts quotes, ampersands and>> less than greater than to entities. It's for handling html tags for>> the most part. htmlentities is supposed to convert all non>> alphanumeric characters.>>
OK, here's the address I'm using. It's my address, so you all are>> going to have to promise not to ring my doorbell at night :')>>
The string I'm starting out with is "1220 Coast Village Road #206". When>I do>>
$addrentities = htmlentities("1220 Coast Village Road #206");>>
and then look at the value of $addrentities it is still "1220 Coast>> Village Road #206". For this particular address, at the bare minimum>> Yahoo needs the # converted to an entity. Converting all of the>> spaces will make it more reliable. Converting any non alphanumeric>> will be best, since end users will tend to put all kinds of stuff>> into addresses. Yahoo seems to handle all the garbage in an address>> pretty well if they're entities.>>
"Rob Brandt" <rbrandt-MM+Gfc+YCh­XR7s880joybQ@public.­gmane.org> wrote in message>> >news:mailman.10340­36881.15843.xaraya_p­ublic-dev-n5IRV0TL0h­wRxVAL8JNkP+OyGI2DFz­Le@public.gmane.org>­> >> Excuse the modules-related question, but all the 'smart people' seem>> >> to be on this list now :')>> >>
I'm working on a module that needs to redirect the user to another>> >> web site. Yahoo maps, to be specific. The url contains an address,>> >> and yahoo maps is choking on "funny" characters in the address. It's>> >> actually works OK if things like spaces and "#"'s are converted to>> >> entities, so I'm trying to do that but it's not working.>> >>
Just as a cursory look at your question (perhaps this will work, perhaps>it>> >won't, not sure what the output you are getting is;) you may want to use>> >htmlspecialcharact­ers instead that htmlentities.>> >
If that doesn't work, could you include the output as an example so we>can>> >see what it is dieing on. I'm not as smart as some (most) of the others,>> >and I kinda need to play with the outputs from time to time.>> ___________________­____________________­________>> Xaraya_public-dev mailing list>> Xaraya_public-dev-n­5IRV0TL0hwRxVAL8JNkP­w@public.gmane.org>>­ http://lists.xaraya­.com/mailman/listinf­o/xaraya_public-dev>­ >
__________________­____________________­_________>Xaraya_pub­lic-dev mailing list>Xaraya_public-­dev-n5IRV0TL0hwRxVAL­8JNkPw@public.gmane.­org>http://lists.xar­aya.com/mailman/list­info/xaraya_public-d­ev


Add comment
Guest 15 December 2009 21:58:12 permanent link ]
 Use:

rawurlencode ($variable);

for htmlentities, you should use:
htmlentities ($variable, ENT_QUOTES, 'utf-8');
Add comment
Guest 23 December 2009 06:57:57 permanent link ]
 S11223J2 Currently, Timberland is one of the most famous Timberland Classic brands. Throughout the 1990s, the popularity of the Timberland Kids Boot reached an important point. Also, in that time, the company added more mens Timberland 6 Inch products and lines to its catalog. Now, the prestige as a Timberland custom boots brand with excellent products is unquestionable.
In preparation for the upcoming cold seasons, the company has launched its collection called Timberland Women's Boots, which is already available at the Timberland stores. http://www.timberla­nder.com/products_al­l.html
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > Content Management System > htmlentities problem 23 December 2009 06:57:57

see also:
[users@httpd] rewriting all domain.com…
[users@httpd] HTTP Authentication…
[users@httpd] APACHE REVERSE PROXYING
pass tests:
Do you know women?
see also:
Hello!
Hello!
Prosto

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .