Solved

Special chars in textarea fields --> MySQL

Posted on 2011-09-14
2
317 Views
Last Modified: 2012-08-13
I have a text area field that is inserted into a MySQL db field.
For characters like (Microsoft) quotes, and diacritical vowels, the result that gets inserted (and thus displayed when the record is retrieved on the web site), is translated into other characters.

For instance,  apostrophe as in   member's
gets captured as ʉ۪
(not sure that will display here:  three characters      a   epsilon   trademark    )

what is the correct strategy along the way to capture correctly or convert appropriately the common  special characters?
Do i need to fabricate a translation table that is applied prior to db INSERTion?

thanks
0
Comment
Question by:willsherwood
2 Comments
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 100 total points
ID: 36540455
Typically, this is handled on the front-end application. If this is PHP for example, you can use the functions like mysql_real_escape_strin().
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 400 total points
ID: 36540722
This has a lot to do with your character set.

First, where is the data coming from?  If it is coming from a web page, you might be receiving ISO-8859-1 (Western/US Latin).  If it is coming from another application, that application will either set its own character set, or use the default from the OS.  

Second, what character set is your server, database, table, field, and connection using?  Note that these are all distinct levels of character set assignment in the database, with different effects at different levels.  For example, your server will set a default character set.  If you do not assign a character set for your connection, you will use the server default.  The database, when it was created, could have been assigned a default character set, or it would have used the server default.  The same with tables (which inherit from the database level) and fields (which inherit from the table level).  

Both of these sets need to match up in order for your special characters to be interpreted properly.  
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question