bbwolff
bbwolff

Reputation: 99

getting special characters in mysql

I'm at begginner level of mysql, doing transition from access to mysql got a very simple routine running, inserting some data from simple phpform into localhost base. i ran into a problem with some slavic characters like čšž as they don't display right

Still get gibberish like this Äćžđšp or this Å¡pela

Any ideas

Upvotes: 0

Views: 99

Answers (1)

ItalyPaleAle
ItalyPaleAle

Reputation: 7336

When dealing with UTF-8, you have to make sure that everything is setup to use UTF-8.

You correctly enabled UTF-8 in the database (make sure that also the column is set to use UTF-8; in my opinion, it's best to use utf8_bin - faster at sorting and less country-specific).
However, what about the web server?

Make sure your pages are using UTF-8, with the correct meta tag:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Additionally, it wouldn't hurt to set the web server to use UTF-8 too: see this question, for example.

Eventually, remember that PHP 5 per se does NOT work with Unicode. As such, you must be extremely careful when using string functions, such as strencode, substr, etc. Some string functions have support for Unicode (see their documentation). In other cases, you may use mbstring functions.

Upvotes: 1

Related Questions