You are here: Re: Best way to encode? « PHP « IT news, forums, messages
Re: Best way to encode?

Posted by Michiel van der Blonk on 01/19/05 23:47

Hi,

use base64_encode() and base64_decode
actually, base32_encode or hexencode would be better, but oh my, php doesn't
have these built in.

If you're using PEAR there is a DataObject_Filter class somewhere that's
handy for encoding decoding on the fly.

Kind regards,
Michiel
*****************************
Michiel van der Blonk
CaribMedia Marketing & Consultancy N.V.
Oranjestad, Aruba
Tel: (297) 583-4144 Fax: (297) 582-6102
http://www.caribmedia.com
----------------------------------------------------
Website Design, Web Application Development,
Web Hosting, Internet Marketing
----------------------------------------------------
Operators of:
Visit Aruba - http://www.VisitAruba.com
Aruba Links - http://www.ArubaLinks.com
Aruba Business Directory - http://www.visitaruba.com/business/
Aruba Real Estate Locator - http://www.arubarealestate.com
Aruba Bulletin Board - http://bb.visitaruba.com/
Aruba Trip Reports - http://tripreports.visitaruba.com
Aruba Chat - http://chat.visitaruba.com
The VisitAruba Plus SAVINGS CARD - http://www.visitaruba.com/plus/
Contents of this communication are confidential and legally privileged. This
document is intended solely for use of the individual(s) or entity/entities
to whom it is addr
"Brian Dunning" <brian@briandunning.com> wrote in message
news:B1D2EE40-6A43-11D9-8AEE-000A95BD6AE4@briandunning.com...
I have a form where people input some text, which is then incorporated
into an HTML snippet which appears in a textarea for them to copy &
paste into a web page.

People will be entering foreign language stuff as well as special
characters like copyright, so I have to be sure this is handled
properly.

I tried rawurlencode() but that results in HTML which displays the
encoding when they paste it into their web page. I tried htmlentities
but that gives different characters than what they typed when displayed
in the textarea. I also tried no encoding, which worked well, except
that it gets messed up when I try to write it to the database and I
have the same problem again when retrieving it.

"Caon " is a good example.
htmlentities('Caon ') -> Cañon © in the textarea, displays on their
web page as Cañon ©, but reads/writes OK from the database.
rawurlencode('Caon ') -> Ca%C3%B1on%20%C2%A9 in the textarea,
displays on their web page as Ca%C3%B1on%20%C2%A9, but reads/writes OK
from the database.
No encoding gives Caon in the textarea and displays on their web
page as Caon , but appears in the database as Cañon ©

How can I handle this so that what ultimately displays on their web
page, after copying the HTML out of the textarea, matches what they
typed in the form, and yet can be read & written from the database
properly?

- Brian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация