Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process percent-encoded string with special characters in PHP

Tags:

string

php

I got an string like:

M%C3%B2nica

So I need to get something like "Mònica".

Which is the best way in PHP?

like image 929
Bernat Avatar asked Dec 27 '22 00:12

Bernat


1 Answers

echo rawurldecode ('M%C3%B2nica'); // prints Mónica

You can either use urldecode() or rawurldecode(), but in your case it probably doesn't make a difference. (read more on this here: urlencode vs rawurlencode?)

like image 127
Jeroen Avatar answered Dec 30 '22 10:12

Jeroen