I'm using document.referrer for grabbing previous URL of current page and sending it to a curl file,that curl file again send this variable to a PHP file for saving it into data base. The problem is that on saving into database I'm getting URL value as accented letters like
†Ûiÿû®û(~×(›û®û(~×â•ïðŠwhÂÏڞئjî
I've used base64
coding scheme in my php file.The collation of MySQL column is latin1_swedish_ci
.
Thanks.
Description. The referrer property contains the URL of the document that was used to reach the current document. If the URL was typed directly into the browser's location field, this property will be empty.
document. referrer gives you the URI of the page that linked to the current page. This is a value that's available for all pages, not just frames. window. parent gives you the parent frame, and its location is its URI.
The Referer header is set by your browser and sent to the server when you request a page. The value of this header is the URL of the previous page that linked to the newly requested page. It is where you came from, essentially.
You can't, document. referrer is a read-only property, which value changes only when picking a link.
As the commenter suggests, I think this is simply a problem where the encoding of the URL isn't the same as the encoding of your database. Using utf-8
on your database tables would solve most (if not all) of your problems. Here is a two part article (part 1 and part 2) that discusses how to use utf-8
in PHP and MySQL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With