I have this some code that will auto generate a string but some of the special characters is shown like: �
Code:
header("Content-type: text/html; charset=utf-8");
function RandomString($length = 10){
$chars ='0123456789abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!#¤%&()=?@£$€{}[]+';
$randString = '';
for($i = 0; $i < $length; $i++){
$randString .= $chars[rand(0, 88)];
}
echo $randString;
return $randString;
}
A string is series of characters, where a character is the same as a byte. This means that PHP only supports a 256-character set, and hence does not offer native Unicode support.- see php.net/manual/en/language.types.string.php and especially the details of the string type.