-1

I am developing an application on Codeigniter and mysql with swedish language. I am using utf8_general_ci Collation for the column which stores names in swedish characters.

In database.php in config directory of CodeIgniter setting are as follow

$db['default']['char_set'] = 'utf8';

$db['default']['dbcollat'] = 'utf8_general_ci';

Now when I save a string containing å (for example qwertåpoiutt). String after å is discarded and save in database before å (save only qwert).

at the same time if I run that query in phpmyadmin then entire string is stored.

Where am I wrong?

Akash Dwivedi
  • 19
  • 1
  • 8
  • You probably do not use utf8 throughout your entire application, from the html input to database insertion. – Shadow May 31 '16 at 11:29
  • On webpage when I show that name I use utf8_encode() when I receive data after form is posted , I use utf8_decode(). On the html page i have used meta tag – Akash Dwivedi May 31 '16 at 11:35
  • Why do you use utf8_encode() and utf8_decode() if you use utf8 throughout your application? – Shadow May 31 '16 at 12:22

2 Answers2

0

Please change your field collation to utf8_swedish_ci or latin1_swedish_ci in database table, it may help you.

amriG
  • 60
  • 10
0

When trying to use utf8/utf8mb4, if you see Truncated text,

  • The bytes to be stored are not encoded as utf8. Fix this.
  • Also, check that the connection during reading is utf8.

You apparently had hex E5, the latin1 encoding, for å, instead of the utf8 encoding: C3A5.

Rick James
  • 135,179
  • 13
  • 127
  • 222