Read a special character, e.g. register a trademark

I use the following statement to read the value and its work well.

$PlaceName=$_REQUEST['PlaceName'];

but there is one problem with the above statement. If we pass in a character of a special type (for example, Burger King ยฎ), then the variable $ PlaceName contains an empty value. Please note that the cause of this problem is the registered trademark symbol (ยฎ)

So, how can I read this type of character in PHP by correcting the above statement?

+1
source share
2 answers

You can try

 header('Content-Type: text/html; charset=utf-8'); $PlaceName= "Burger King ยฎ" ; echo $PlaceName; 
+4
source

This is due to your encoding, make sure your output is set to utf8 .

I just tested this code and the output was valid.

 <form method="post" action=""> <input type="text" name="name" /> <input type="submit" /> </form> <?php if ($_POST){ $name = $_POST['name']; echo '<pre>'; var_dump($_POST); echo '</pre>'; echo '<hr />'; echo $name; } 
0
source

Source: https://habr.com/ru/post/1440946/


All Articles