: Javascript and PHP how should I en/decode my data I would like to know in what encryption should I encode my data and why. First of all, I use GET method because it is search engine inside
I would like to know in what encryption should I encode my data and why. First of all, I use GET method because it is search engine inside website. Second, I use RTL language (hebrew). And third which basically is why I ask this question - Firefox and Safari (as I understand it) encode and decode urls automatically. So if I encoded the url, in Firefox I will see it decoded which is good. But if I copy-paste the url to the address bar and than enter the site, Firefox encodes the uncoded url to UTF (I think).
What en/decode should I use? And how can I overcome the Firefox auto en/decode?
More posts by @Shakeerah822
3 Comments
Sorted by latest first Latest Oldest Best
You're mixing up a lot of things. But to answer your question: it's good practice to always encode non-ascii / special characters in URLs, so keep doing that. But there's nothing you can do about how browsers handle URLs in the address bar.
Modern browsers are automatically decode URLs before displaying on the location bar, but internally still using the real address which will include two different encodings for the path to the resource and the domain.
When you copy the location from the browser it copy the original address with a purpose to make sure that it would act as a web address when pasted on other applications.
It's unclear exactly what you're asking about; it seems you're confusing concepts of encryption, content encoding, and URL encoding.
I'll assume this is not related to encryption. Regarding content encoding, any modern browser (even IE 6) handles Unicode. As long as your PHP files are encoded as UTF-8 or UTF-16, you should be able to use any Hebrew language code points you'd like. Most web servers when serving up PHP will look at the encoding of the source file and use that in the content type of the pages that are served up, but if you want to be safe, you can explicitly have your PHP send content encoding HTTP headers:
<?php header("Content-Type: text/html; charset=UTF-16"); ?>
As far as URL go, you should URL-encode all URLs and not worry how the browsers will display them in the address bar. A browser will usually (I haven't seen it happen otherwise) URL-encode any invalid characters in an entered address, so even if Firefox decodes a URL in the address bar, pasting it into another browser should still work.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.