this is a problem, I have drop down menu witch is giving me a data from my sql data base table but charter like č,ć is being replaced by "?" Why is that so? I'm confused, encription is fine in php doc. Any ideas? :)
Asked
Active
Viewed 526 times
-5
-
@YanickRochon I have suspect that but the whole page is fine except the drop down menu.... that is confusing. – Intex Jan 06 '13 at 02:56
-
2Is this issue not related to a previous one of yours that was solved using a specific font? http://stackoverflow.com/questions/10685964/why-cant-i-use-c-c-d-charters-in-tcpdf-table/11458799#11458799 – nerdarama Jan 06 '13 at 03:01
2 Answers
2
If you're using Windows to edit your files, your character set will probably be CP-1251. If you're sending UTF-8 characters, they will get corrupted.
Check that all of these are using the UTF-8
character set :
- Your source file (must be saved with the correct character set. Depending on your editor, this feature may not be available. Use an editor that let you save with a specific charset.)
Your HTTP content type. For example :
header('Content-type: text/html; charset=utf-8');
Your HTML meta attribute (in your
<head>
element) :<meta charset="UTF-8" />
or (for HTML4)
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
** Edit **
If your issue is from your database (it's not specified which one in your quesiton tags, but I'll suspect it's MySQL), then you have to establish the connection also with the given charset. Execute this query :
SET NAMES 'utf8'

Community
- 1
- 1

Yanick Rochon
- 51,409
- 25
- 133
- 214
-
@Intex, note that one of your previous question has an answer suggesting that you can force `cp-1251` on your data in your PHP scripts... I strongly disapprove and would very much recommend to use only unicode character sets in your projects. You need less character conversion when using unicode, and it's much safer with international strings (except a few like Taï and such, but even with that, UTF-8 is a better choice). – Yanick Rochon Jan 06 '13 at 03:16
-
Great can i get more down votes? at lest to get my rep to 0... you all ar very helpful :( but the problem as usual until I my selfe sort it out. Asking help from this site is depresing.I give up. – Intex Jan 06 '13 at 18:36
-
@Intex, I agree with you. I have seen a rise of downvotes without helpful comments (or just any good reason for it) in the past weeks on StackExchange and this is getting frustrating even for people who's been here for a few years now. For what's worth, I have upvoted you and submitted this question for re-opening. – Yanick Rochon Jan 06 '13 at 19:33
-
Thanks Yanick it is pleasing to see someone understanding me, and yes this is frustrating. I have found one more question with same problem and it is not solved as well sou if I'm asking a stupid question why no one knows the answer to that other question? this is that other question --> http://stackoverflow.com/questions/4417712/mysql-data-contains-special-characters-like-s-and-c-but-they-are-displayed-as – Intex Jan 06 '13 at 20:19
0
Set your content-encoding HTTP header to UTF-8.
HTML 4.01: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
HTML5: <meta charset="UTF-8">

Bhavik Shah
- 2,300
- 1
- 17
- 32

hd1
- 33,938
- 5
- 80
- 91
-
-
@hd1 my content-encoding is fine it is ok, it is as it suposed to be. It is not problem in that as I said. – Intex Jan 06 '13 at 03:03