How to allow fulltext searching with hyphens in the search query

From here http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html One solution to find a word with a dashes or hyphens in is to use FULL TEXT SEARCH IN BOOLEAN MODE, and to enclose the word with the hyphen / dash in double quotes. Or from here http://bugs.mysql.com/bug.php?id=2095 There is another workaround. It was recently added to the manual: ” Modify a … Read more

jQuery: Check if special characters exists in string

If you really want to check for all those special characters, it’s easier to use a regular expression: var str = $(‘#Search’).val(); if(/^[a-zA-Z0-9- ]*$/.test(str) == false) { alert(‘Your search string contains illegal characters.’); } The above will only allow strings consisting entirely of characters on the ranges a-z, A-Z, 0-9, plus the hyphen an space … Read more

Post UTF-8 encoded data to server loses certain characters

After much research and attempts to make things working, I finally found a solution for the problem, that is a simple addition to existing code. Solution was to use parameter “UTF-8” in the UrlEncodedFormEntity class constructor: form = new UrlEncodedFormEntity(nameValuePairs,”UTF-8″); After this change, characters were encoded and delivered properly to the server side.

Browser displays � instead of ´

You have to make sure the content is served with the proper character set: Either send the content with a header that includes <?php header(“Content-Type: text/html; charset=[your charset]”); ?> or – if the HTTP charset headers don’t exist – insert a <META> element into the <head>: <meta http-equiv=”Content-Type” content=”text/html; charset=[your charset]” /> Like the attribute … Read more

Working with GD ( imagettftext() ) and UTF-8 characters

As I continued my research I came up with an answer for my problem, this piece of code did it! private function properText($text){ $text = mb_convert_encoding($text, “HTML-ENTITIES”, “UTF-8”); $text = preg_replace(‘~^(&([a-zA-Z0-9]);)~’,htmlentities(‘${1}’),$text); return($text); } Now all the characters (and all the new ones I’ve seen) that troubled me are displayed correctly!