Document.referrer provides accented letters

I use document.referrer to capture the previous URL of the current page and send it to the curl file, this curl file sends this variable to the PHP file again to save it to the database. The problem is that when I save to the database, I get the URL value in the form of accented letters, for example

†Ûiÿû®û(~×(›û®û(~×â•ïðŠwhÂÏڞئjî 

I used base64 encoding scheme in my php file. A generalization of the MySQL column latin1_swedish_ci .

Thanks.

+7
source share
1 answer

As the commentator points out, I think this is just a problem when the URL encoding does not match the encoding of your database. Using utf-8 in 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.

+3
source

All Articles