r4shyd Posted May 26, 2012 Share Posted May 26, 2012 hi im tryng to add data using html form to sql db when i enter "ޖހދޖހސދ" dhivehi letters and submit the form that value is changed in the database to "Þ‡Þ¦Þ‡Þ¨Þަތު" this.. so what is wrong, thanx Quote Link to comment https://forums.phpfreaks.com/topic/263190-unicode-to-database-changes-after-form-submit/ Share on other sites More sharing options...
gizmola Posted May 27, 2012 Share Posted May 27, 2012 Speaking in general terms, you want the character set to match across the board, from the browser to the client database connection to the database/column. Your best bet is to use UTF8 for everything. Quote Link to comment https://forums.phpfreaks.com/topic/263190-unicode-to-database-changes-after-form-submit/#findComment-1348882 Share on other sites More sharing options...
r4shyd Posted May 28, 2012 Author Share Posted May 28, 2012 sorry,, what do you mean everything html page <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> database # Column Type Collation Attributes Null Default 2 lname varchar(100) utf8_unicode_ci No None Change Drop thnks for the reply Quote Link to comment https://forums.phpfreaks.com/topic/263190-unicode-to-database-changes-after-form-submit/#findComment-1349233 Share on other sites More sharing options...
gizmola Posted May 29, 2012 Share Posted May 29, 2012 MySQL also has a client charset that in cases like this, often does not default to UTF-8. For this reason many people build a call into their database class to set the client charset explicitly. Many people do this by issuing this query just after they connect to the database: SET NAMES UTF8 Quote Link to comment https://forums.phpfreaks.com/topic/263190-unicode-to-database-changes-after-form-submit/#findComment-1349676 Share on other sites More sharing options...
r4shyd Posted May 30, 2012 Author Share Posted May 30, 2012 thank you very much for the help. Quote Link to comment https://forums.phpfreaks.com/topic/263190-unicode-to-database-changes-after-form-submit/#findComment-1349858 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.