son Posted January 25, 2010 Share Posted January 25, 2010 Does anyone know what is the best collation to use with German? I use utf8_general_ci, but seems to give issues here and there...SonIn addition, the database storesmaßwhenmaßis entered. However, it displays on website code as:maßwhich is correct.Isßthe correct way to store the letterßthen? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 25, 2010 Share Posted January 25, 2010 ß is the ASCII representation of the UTF sequence for the beta character. UTF is a multi-byte character set, one character may require 2 or 3 bytes. ASCII is a single-byte character set, each ASCII character is one byte. So when you get an ASCII system try to read a UTF system, it's expecting that each character takes up only a single byte. When it gets to a character which takes up 2 bytes, it will write 2 characters for it (whichever 2 ASCII characters happen to match those two bytes). So the bits that are represented by ß make up the bit sequence for the beta character. Link to comment Share on other sites More sharing options...
son Posted January 26, 2010 Author Share Posted January 26, 2010 ß is the ASCII representation of the UTF sequence for the beta character. UTF is a multi-byte character set, one character may require 2 or 3 bytes. ASCII is a single-byte character set, each ASCII character is one byte. So when you get an ASCII system try to read a UTF system, it's expecting that each character takes up only a single byte. When it gets to a character which takes up 2 bytes, it will write 2 characters for it (whichever 2 ASCII characters happen to match those two bytes). So the bits that are represented by ß make up the bit sequence for the beta character.But where is the ASCII system? The database fields are set toutf8_general_ci, Unicode (multilingual), case-insensitiveand the web page that has form to insert new rows into table has at the first two rowsheader('Content-Type: text/html;charset=utf-8');mysqli_set_charset($dbc, 'utf8');In addition, I use the mail function and the values that are entered from form fields are being also emailed to another user. Again, the letters arrive in the ASCII representation. What would I need to do to make sure the German characters arrive ok (both mail and database)?Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 the web page that has form to insert new rows into table has at the first two rowsheader('Content-Type: text/html;charset=utf-8');mysqli_set_charset($dbc, 'utf8');Right, that's why it displays the data correctly as UTF characters instead of ASCII characters. Whatever you're using when you see the ASCII characters is not using a UTF character set, so it's displaying everything as ASCII.In addition, I use the mail function and the values that are entered from form fields are being also emailed to another user. Again, the letters arrive in the ASCII representation.You need to send the email as an HTML email and set the character set with meta tags. Link to comment Share on other sites More sharing options...
son Posted January 26, 2010 Author Share Posted January 26, 2010 Right, that's why it displays the data correctly as UTF characters instead of ASCII characters. Whatever you're using when you see the ASCII characters is not using a UTF character set, so it's displaying everything as ASCII.You need to send the email as an HTML email and set the character set with meta tags.I had already all fields in database set as UTF-8 general, but now I changed each table, the database and even phpMyAdmin to use this collation. In addition, I checked the web page viewing the database in phpMyAdmin. Even this one shows: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />Where else would I need to look? I thought my web page with form and database are the only factors to potentially throw collation problems...Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 I'm not sure what the problem is, you say it's displaying correctly on the website, right? So obviously it's being stored correctly in the database, even if it's not displaying correctly in phpMyAdmin. Link to comment Share on other sites More sharing options...
son Posted January 26, 2010 Author Share Posted January 26, 2010 I'm not sure what the problem is, you say it's displaying correctly on the website, right? So obviously it's being stored correctly in the database, even if it's not displaying correctly in phpMyAdmin.So, you would not worry about it? But does not really make sense, does it?Also, the mail sending works nows. Does it need to be send like a normal HTML page? At present I have only:$to = info@domain.de;$subject = "New Entry";$S = Date" . $day . "." . $month . "." . $year."<br />\n";$S .= "Text: " . $evt_desc. "<br />\n"; // Content-type for sending HTML email$headers = "MIME-Version: 1.0" . "\r\n";$headers .= "Content-type:text/html;charset=utf-8" . "\r\n";// More headers$headers .= "From: info@domain.de\r\n";mail($to,$subject,$S,$headers); Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 So, you would not worry about it? But does not really make sense, does it?Somehow it's being interpreted as ASCII text, why I don't know.Does it need to be send like a normal HTML page?Ideally it would be a full HTML page. Link to comment Share on other sites More sharing options...
son Posted January 27, 2010 Author Share Posted January 27, 2010 Somehow it's being interpreted as ASCII text, why I don't know.Ideally it would be a full HTML page.Many thanks for your help. Will try to find out why it thinks it is ASCII...Best regards,Sonja Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.