Some characters become “�” in our webpage
up vote
1
down vote
favorite
I use PHP to access a database to get a string like this
‘Chloe’ Fashion Show & Dinner
and then I do a printf() to output the string as html, but my webpage shows this:
�Chloe� Fashion Show & Dinner
All contents are English-based, do I miss something in PHP?
Where should I be checking?
php string encoding
add a comment |
up vote
1
down vote
favorite
I use PHP to access a database to get a string like this
‘Chloe’ Fashion Show & Dinner
and then I do a printf() to output the string as html, but my webpage shows this:
�Chloe� Fashion Show & Dinner
All contents are English-based, do I miss something in PHP?
Where should I be checking?
php string encoding
1
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
1
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot guys.
– Joe Huang
Oct 31 '13 at 10:00
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I use PHP to access a database to get a string like this
‘Chloe’ Fashion Show & Dinner
and then I do a printf() to output the string as html, but my webpage shows this:
�Chloe� Fashion Show & Dinner
All contents are English-based, do I miss something in PHP?
Where should I be checking?
php string encoding
I use PHP to access a database to get a string like this
‘Chloe’ Fashion Show & Dinner
and then I do a printf() to output the string as html, but my webpage shows this:
�Chloe� Fashion Show & Dinner
All contents are English-based, do I miss something in PHP?
Where should I be checking?
php string encoding
php string encoding
edited Nov 11 at 6:59
Cœur
17.1k9102140
17.1k9102140
asked Oct 31 '13 at 9:28
Joe Huang
3,74242459
3,74242459
1
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
1
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot guys.
– Joe Huang
Oct 31 '13 at 10:00
add a comment |
1
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
1
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot guys.
– Joe Huang
Oct 31 '13 at 10:00
1
1
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
1
1
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
mysqli_set_charset($link, "utf8") solves the problem, thanks a lot guys.– Joe Huang
Oct 31 '13 at 10:00
mysqli_set_charset($link, "utf8") solves the problem, thanks a lot guys.– Joe Huang
Oct 31 '13 at 10:00
add a comment |
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
- Check if your .php file is encoded as UTF-8 without BOM
- Check that your connection to the database is UTF-8
- Check that you send
<meta charset="utf-8">in your HTML markup in the<head>tag
If your connection to the database is not UTF-8 and you don't want to change it (but I recommend it -> everything UTF-8 is the most secure solution against character rubbish) use utf8_encode($databaseValue) to ensure the encoding of your value is UTF-8.
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I useutf8_encodeand�characters are not there anymore. However, the original characters‘are gone too. It's kind of weird.
– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot.
– Joe Huang
Oct 31 '13 at 9:57
add a comment |
up vote
1
down vote
Make sure that you use:
<meta charset="utf-8">
in the head of your page.
add a comment |
up vote
1
down vote
You need to add charset meta tag in 'head' section of html.
Note that the meta tag must appear within the first 1024 bytes of rendered page.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
- Check if your .php file is encoded as UTF-8 without BOM
- Check that your connection to the database is UTF-8
- Check that you send
<meta charset="utf-8">in your HTML markup in the<head>tag
If your connection to the database is not UTF-8 and you don't want to change it (but I recommend it -> everything UTF-8 is the most secure solution against character rubbish) use utf8_encode($databaseValue) to ensure the encoding of your value is UTF-8.
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I useutf8_encodeand�characters are not there anymore. However, the original characters‘are gone too. It's kind of weird.
– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot.
– Joe Huang
Oct 31 '13 at 9:57
add a comment |
up vote
6
down vote
accepted
- Check if your .php file is encoded as UTF-8 without BOM
- Check that your connection to the database is UTF-8
- Check that you send
<meta charset="utf-8">in your HTML markup in the<head>tag
If your connection to the database is not UTF-8 and you don't want to change it (but I recommend it -> everything UTF-8 is the most secure solution against character rubbish) use utf8_encode($databaseValue) to ensure the encoding of your value is UTF-8.
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I useutf8_encodeand�characters are not there anymore. However, the original characters‘are gone too. It's kind of weird.
– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot.
– Joe Huang
Oct 31 '13 at 9:57
add a comment |
up vote
6
down vote
accepted
up vote
6
down vote
accepted
- Check if your .php file is encoded as UTF-8 without BOM
- Check that your connection to the database is UTF-8
- Check that you send
<meta charset="utf-8">in your HTML markup in the<head>tag
If your connection to the database is not UTF-8 and you don't want to change it (but I recommend it -> everything UTF-8 is the most secure solution against character rubbish) use utf8_encode($databaseValue) to ensure the encoding of your value is UTF-8.
- Check if your .php file is encoded as UTF-8 without BOM
- Check that your connection to the database is UTF-8
- Check that you send
<meta charset="utf-8">in your HTML markup in the<head>tag
If your connection to the database is not UTF-8 and you don't want to change it (but I recommend it -> everything UTF-8 is the most secure solution against character rubbish) use utf8_encode($databaseValue) to ensure the encoding of your value is UTF-8.
edited Jan 9 '14 at 8:02
answered Oct 31 '13 at 9:31
TiMESPLiNTER
4,19811547
4,19811547
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I useutf8_encodeand�characters are not there anymore. However, the original characters‘are gone too. It's kind of weird.
– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot.
– Joe Huang
Oct 31 '13 at 9:57
add a comment |
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I useutf8_encodeand�characters are not there anymore. However, the original characters‘are gone too. It's kind of weird.
– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot.
– Joe Huang
Oct 31 '13 at 9:57
1
1
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I'd also check Apache/PHP config to send default charset utf8, mostly the problem is the first point you mention anyways, the file contents itself should be utf8 of course
– DanFromGermany
Oct 31 '13 at 9:33
I use
utf8_encode and � characters are not there anymore. However, the original characters ‘ are gone too. It's kind of weird.– Joe Huang
Oct 31 '13 at 9:52
I use
utf8_encode and � characters are not there anymore. However, the original characters ‘ are gone too. It's kind of weird.– Joe Huang
Oct 31 '13 at 9:52
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
Have you checked and fixed all 3 points of my checklist?
– TiMESPLiNTER
Oct 31 '13 at 9:53
1
1
mysqli_set_charset($link, "utf8") solves the problem, thanks a lot.– Joe Huang
Oct 31 '13 at 9:57
mysqli_set_charset($link, "utf8") solves the problem, thanks a lot.– Joe Huang
Oct 31 '13 at 9:57
add a comment |
up vote
1
down vote
Make sure that you use:
<meta charset="utf-8">
in the head of your page.
add a comment |
up vote
1
down vote
Make sure that you use:
<meta charset="utf-8">
in the head of your page.
add a comment |
up vote
1
down vote
up vote
1
down vote
Make sure that you use:
<meta charset="utf-8">
in the head of your page.
Make sure that you use:
<meta charset="utf-8">
in the head of your page.
answered Oct 31 '13 at 9:31
Wayne Whitty
15.3k33358
15.3k33358
add a comment |
add a comment |
up vote
1
down vote
You need to add charset meta tag in 'head' section of html.
Note that the meta tag must appear within the first 1024 bytes of rendered page.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
add a comment |
up vote
1
down vote
You need to add charset meta tag in 'head' section of html.
Note that the meta tag must appear within the first 1024 bytes of rendered page.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
add a comment |
up vote
1
down vote
up vote
1
down vote
You need to add charset meta tag in 'head' section of html.
Note that the meta tag must appear within the first 1024 bytes of rendered page.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
You need to add charset meta tag in 'head' section of html.
Note that the meta tag must appear within the first 1024 bytes of rendered page.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
edited Oct 31 '13 at 11:08
Joran Den Houting
2,74431647
2,74431647
answered Oct 31 '13 at 9:31
jondinham
4,7041260119
4,7041260119
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19702687%2fsome-characters-become-in-our-webpage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Do you have the utf8 meta tag ?
– Patsy Issa
Oct 31 '13 at 9:29
Add utf8 meta tag in HTML page ..
– Akhil Thayyil
Oct 31 '13 at 9:30
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
– Akhil Thayyil
Oct 31 '13 at 9:30
1
Check for the document's character set. You can see and change with a code editor like "Notepad++". Try to convert utf8.
– R. Canser Yanbakan
Oct 31 '13 at 9:31
mysqli_set_charset($link, "utf8")solves the problem, thanks a lot guys.– Joe Huang
Oct 31 '13 at 10:00