1

I want to insert some word which is languages of Europe to MySQL. e.g á, ó, Ö,ü.(Sorry, I don't know what language it is. Maybe somebody can help me fix title.)

But it become something can't read.

I try this solution How to Inserting french characters in mySQL DB table?

I find out my PHP version is 5.1.6. So I can't use mysql_set_charset

Mysql charset is utf8_general_ci and version is 5.0.45.

How can I fix this problem?

Community
  • 1
  • 1
James
  • 143
  • 1
  • 8
  • 1
    UTF-8 is what you want. Use `utf8mb4_*` charsets in MySQL as they are true Unicode sets. In PHP you need to use the MultiByte extension to process the data. You also need to specify that the website's encoding is UTF-8 so that the browser will send the data in UTF-8 and not ISO-8859-1. – Charlotte Dunois Jan 21 '16 at 05:19
  • You should update your PHP version, you are going to be running into main outdate functions in the future. – chris85 Jan 21 '16 at 05:21
  • I don't have the privilege to update PHP or change MySQL charset..... – James Jan 21 '16 at 05:23
  • 1
    Side question: Is there any reason why you don't upgrade your PHP version? 5.1 is too outdated. If your hostprovider is the reason, ask him to upgrade the PHP version. If he doesn't, change provider. I wouldn't want to host anything on servers of a host provider if he doesn't want to use an up to date PHP version. PHP 5.5 (better 5.6) as minimum is obligatory – Charlotte Dunois Jan 21 '16 at 05:24
  • Sorry but this question is a nice mess... Not sure what help you want with the title... Languages spoken in Europe include French, Spanish, Czech, Ukrainian, Greek... (we will not mention Arabic or Chinese) so there aren't any alternatives beyond Unicode charsets like UTF-8. However, you suggest you're already using UTF-8... and then argue that your system specs don't allow you to do it properly. – Álvaro González Mar 01 '16 at 15:29

1 Answers1

-1

DB changes:

  • change charset in your DB, tables + columns (yes! changing table charset is not enough, you have to do it column by column! Took me long time to figure this out!) to "UTF8"

  • change collation in your DB, tables + columns (really check every column) to "utf8_slovak_ci"

  • import the DATA and check that it looks fine in your DB

PHP changes:

When querying, use "mysql_query('SET character_set_results = UTF8;');" prior to SELECT/UPDATE statements

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Not enough. "results" is only for reads; you need it for writes too. Instead, execute `SET NAMES utf8`. – Rick James Jan 26 '16 at 00:11
  • try this http://stackoverflow.com/questions/1703636/how-to-store-euro-symbol-in-mysql-database?answertab=votes#tab-top it's works fine for me. – Mahesh Gareja Jan 28 '16 at 07:09