<?php
echo rawurldecode('%26%233221%3B%26%233240%3B%26%233277%3B%26%233240%3B%26%233233%3B') . PHP_EOL;
echo rawurldecode('%E0%B2%95%E0%B2%A8%E0%B3%8D%E0%B2%A8%E0%B2%A1');
... prints:
ಕನ್ನಡ
ಕನ್ನಡ
Your two strings are simply different even though, when rendered in HTML context, they look the same.
Edit #1: It's actually possible to obtain HTML entities within your POST variables but that's a browser feature: if the user types some characters that are not supported by the document encoding inside an HTML form, the browser prefers to generate HTML entities instead of sending or dropping unsupported characters. But you do you need a browser; it won't happen if you fill $_POST
manually from PHP.
Edit #2: As I was suspecting, the code you posted wasn't the actual code. Your input strings are not the same but you didn't notice because you are manipulating the form data as HTML:
echo $_POST['kannada']."<br/>";
... thus your HTML entities are being rendered as HTML. You need to do this:
echo htmlspecialchars($_POST['kannada'])."<br/>";
The rest is what I already said. Your page is not being interpreted as UTF-8. Make sure that:
- Your editor is saving files as UTF-8
The web server is sending a correct
Content-Type
header. You can force it from PHP:header('Content-Type: text/html; charset=utf-8');