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
- Formatting my post
- How to blend adsense inside your post?
- PHPWind-- A PHP forum script applcaition in China
- PHP: add a download as pdf file button in report page
- ActionScript 3.0 demo: create a falling snow in flash CS6
- Notepad++ - Add C++ compiler
- Datatable export excel wraptext and newline
- phpexcel toggle expand and hide column in EXCEL and summary
- PHP - Export Content to MS Word document
- PHP connect IBM db2 database in XAMPP
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