Welcome Guest, Not a member yet? Register   Sign In
German Umlauts from Database to input Field
#1

[eluser]Unknown[/eluser]
Hello everyone,
I've got German Umlauts in my Database for Real Names of Users. For example "Müller".

With this Code I take the Values from my Database:
Code:
$this->db->select('*');
        $this->db->from('user');
        $this->db->join('profile','user.ID = profile.user_id','left');
        $this->db->where('username', $name);
        
        $query = $this->db->get();
        
        return $query->row_array();

Now I want to put the Name and the other values into some input fields in a From

Code:
echo form_input('name',$profile['name'],'class="form-control" style="width:300px;"');

But instead of Müller, the input field shows me Müller. How can I fix that Problem?

I tried utf8_encode(), utf8_decode() and htmlenteties(), but nothing worked for me.
My charset is also utf-8.
#2

[eluser]CroNiX[/eluser]
DB needs to be UTF8, data in DB needs to be in UTF8, DB connection needs to be UTF8, HTML Charset needs to be UTF8, files/encoding need to be UTF8, PHP needs to be UTF8, use PHP mb_* equivalent functions instead of standard functions (like mb_strtotupper() instead of strtoupper()). Basically, everything needs to be UTF8. If there are any holes, you will have problems.

http://www.toptal.com/php/a-utf-8-primer...-and-mysql
#3

[eluser]ivantcholakov[/eluser]
If you use MySQL, in addition of what CroNiX says, you may detect/check quickly what is the situation with database encodings if you open the database with phpMyAdmin. Check the tables and their string fields, what are the encodings. Open with phpMyAdmin the corresponding record with the word “Müller” and see whether it is shown correctly.

Edit: If you have doubts about whether recorded data is damaged, you may check it this way: Make a dump of some table, open the dump with a text editor and make sure that the text is previewed in UTF-8 encoding. Find and check the word “Müller”.
#4

[eluser]Unknown[/eluser]
Thanks Guys,

My Database and the Fields in the Table stands on latin, not utf-8.

As I changed it, it works.

Sometimes you can't see the wood for the trees...
#5

[eluser]InsiteFX[/eluser]
Make sure that your Database COLLATION is also set to utf8_unicode_ci when you create it.




Theme © iAndrew 2016 - Forum software by © MyBB