Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

javascript encoding and php decoding

Posted on 2006-11-03
3
1,932 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

837 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