Online computer courses, code, programming tutorial and sidebar information for monitoring Canadian S&P/TSX index. Build friendship and networking. Welcome to visit my blogs often!!! I also have two other sites: YouTube Channel and Google site.
Adsense
Popular Posts
- PHPWind-- A PHP forum script applcaition in China
- Using Cron Job to process PHP scripts
- Install PHPMailer 5.2.4 and use smtp gmail
- Set up a child account and set screen time limit in Windows 8
- PHP connect IBM db2 database in XAMPP
- job interview questions (1)
- PHP - Export Content to MS Word document
- Ajax autosave selection without submit button
- Powerful js library datable to export table in pdf, excel, sorting, freezing column and table header fixed (sticky)
- Datatable export excel wraptext and newline
Monday, October 24, 2011
PHP, text after apostrophe or hyphen cutoff
In some scenarios when a piece of text is pasted from Word to online visual editor, if the text contains an apostrophe or hyphen, all text that comes after the apostrophe or hyphen will not cutoff in MYSQL database. mb_convert_encoding function can be used to solve this problem:
$sql_subject =mb_convert_encoding($_POST['subject'], 'HTML-ENTITIES', 'OLD-ENCODING');
$sql_subject =ereg_replace("’", "'", $sql_subject);
$sql_subject=$addslashes(html_entity_decode($sql_subject));
’ is for ', mb_convert_encoding will automatically solve hyphen cutoff problem.
For using function mb_convert_encoding:
In C:/php5.3.1/php.ini, line 960, un-comment
extension=php_mbstring.dll
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment