Solved

javascript encoding and php decoding

Posted on 2006-11-03
3
1,931 Views
Last Modified: 2009-06-08

we're using javascript to encode a form and submit it to a php script.

it works well for the most part but certain characters don't seem to be decoded by php correctly.

For example, if we use the javascript function encodeURIComponents on a right curly quote (”) it produces: %E2%80%9D

when php decodes this, we get three characters: the letter a with a circumflex, what looks like a Euro sign, and some other character (”)

is there a way we can get php to understand that these three codes are actually one right curly quote character ... or a way we can get javascript to convert it to a code that php will decode correctly.

PS - I'm not sure how the special characters I've pasted into this text box will get displayed on experts-exchange.

-Charlie
0
Comment
Question by:gothamww
3 Comments
 
LVL 15

Accepted Solution

by:
JakobA earned 500 total points
ID: 17871739
It sound like your PHP and your browser uses different character sets. the characters abowe %80 vary in different languages and character sets.

In this case it even seems like Javascript uses unicode in its encoding (16 bit characters) that lets it encode any of thousands of different characters (sigma. epsilon, arabic, katakana).

But AFAIK there is no version of PHP that support other than 8-bit character sets (not sure here, wait for other comments)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Taxonomy 2 29
php convert date format 3 22
php mysql check email already in database. (second check) 7 30
Get a subdirectory name from a url 5 14
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question