0

I have written a small social network on my pc in my localhost xampp. Here everything works fine.

Text in my mySQL Database looks like this: "was für pizza?" instead of "was für Pizza?". This is fine, it is displayed like "was für Pizza?" in my localhost on my PC.

But now I uploaded it to my Webspace and there I got this "was für pizza?" displayed.

Can anyone help me?

progNewbie
  • 4,362
  • 9
  • 48
  • 107

3 Answers3

1

Some steps:

  • Make sure your table/columns are set to a unicode collation. An older, but still good one is utf8_unicode_ci. It works for most cases, but if you're going to have emoji (which you might with a social network) you'll want to use utf8mb4_unicode_ci.
  • Make sure that PHP's connection with the database is UTF8. This is generally accomplished by running the query SET names 'utf8'
  • Make sure your website is telling the browser that it's UTF8. This is generally accomplished by sending the Content-Type: text/html;charset=utf-8 header, by including a meta tag that says the same thing, <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> or by including a meta-charset tag (newer) <meta charset="utf-8" />
Navarr
  • 3,703
  • 7
  • 33
  • 57
  • i did these steps, but it didn't help :/ – progNewbie Nov 24 '14 at 23:38
  • @progNewFag If using utf8_decode() fixed your problem than it's because your page isn't being interpreted in UTF-8 (or some step between your database and output isn't UTF-8; as utf8_decode transform UTF into ISO-8859-1. – Navarr Nov 26 '14 at 02:44
  • so how can i fix this? Where lies the mistake that the page isn't interpreted in UTF-8? – progNewbie Nov 26 '14 at 20:54
  • @progNewFag without seeing the page there's not much I can help you with. You should double check the content-type header and make sure you have the charset=utf-8 tag – Navarr Nov 27 '14 at 00:30
0

This sounds like an issue with character encoding, you need to use utf-8. I think the default is ascII. I only write pages in English but this guy has all of the steps needed.

Useless Intern
  • 1,294
  • 1
  • 10
  • 20
0

You can convert the file to UTF8 using notepad plus plus. Try it.