Re: Best way to encode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx> wrote in message
news:B1D2EE40-6A43-11D9-8AEE-000A95BD6AE4@xxxxxxxxxxxxxxxxxxx
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.

"Cañon ©" is a good example.
htmlentities('Cañon ©') -> Cañon © in the textarea, displays on their
web page as Cañon ©, but reads/writes OK from the database.
rawurlencode('Cañon ©') -> 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 Cañon © in the textarea and displays on their web
page as Cañon ©, 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux