php - html entities not converting special characters -
i'm using htmlentities converting characteres accents, not converting type of quotes “. instead browser shows weird symbol question mark �
how can convert these kind of characteres display symbols? e.g. book called �hello colors� on table.
i've tried commands it's not working:
htmlentities($message); htmlentities($message, ent_quotes, 'utf-8'); htmlentities($message, ent_noquotes, 'utf-8'); htmlentities($message, ent_compat, 'utf-8');
thank you.
i realised weird, if next
echo $message; die();
to show white page debugging quotes displayed! happening? why it's not displaying correctly in website page? :s
looks have missed charset specification in browser ,
try adding <meta charset="utf-8">
in webpage head section . had issue display multilingual text in utf -8 did same solve issue .
hope helps
btw
for html 5 <meta charset="utf-8">
works
in case of html 4
<meta http-equiv="content-type" content="text/html;charset=utf-8">
and in case of xml have specify
<?xml version="1.0" encoding="utf-8"?>
here place can info
declaring character encodings in html
there several ways setup content charset , can setup server render utf-8 can read here more info in server setup section
edit : -
after conversation in comment section ,
your problem joomla
you tested putting charset iso-8859 in webpage , works proves getting content in iso not in utf-8
probabily mysql database not in utf-8 think , why sending iso text front end , can alter db utf-8 general-ci or iso latin1 ever feasible , works suggest alter db utf-8-general-ci since have html pages header set utf-8 , solve problem .
also if cant alter db know in iso charset alter joomla template header iso charset .
which looks
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
or
in php
header('content-type: text/html; charset=iso-8859-1');
by removing charset utf-8 declaration existing .
php character html-entities
No comments:
Post a Comment