Discuss Reverse htmlspecialchars or something in the PHP Development forum on Dev Shed. Reverse htmlspecialchars or something PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
Posts: 16
Time spent in forums: 5 h 4 m 6 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
Reverse htmlspecialchars or something
I have a project that gets from mysql the data that i search.
Until 10 minutes ago, the results could not display me correctly the Greek characters from mysql.
The search system searches the title of the item which contains English and Greek characters.
I solve this problem with this :
I use notepad for any encoding i do between ansi, unicode and utf8.
I wrote into notepad the title in English and for the Greek letters i wrote them in HTML encoded characters and i saved it as ANSI.
On phpmyadmin I uploaded the file choosing utf8 for Character set of the file and ANSI for sql compatibility.
i searched for that English word i wrote in the title and displayed to me the result WITH GREEK LETTERS correctly.
This is the only way to display Greek letters. I tried everything.
The problem is :
When i searched using that Greek letters that i wrote in the title the result showed me nothing. Then i searched again using the HTML encoded characters i used for that title and i got the result with Greek letters!
Having in mind that with HTML encoded characters the system found me the result, I guess there must be a line that it will convert the Greek characters to HTML encoded characters before it gives me the results.
Posts: 10,252
Time spent in forums: 4 Months 3 Weeks 6 Days 17 h 52 m 19 sec
Reputation Power: 7602
Quote:
Originally Posted by Anoole
because it didnt give the correct result!
PHP Code:
<?php
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
?>
this code does not work for me.
It's working perfectly fine so stop complaining.
When you echo "A 'quote' is <b>bold</b>" you expect to see the word "bold" in bold, right? Because of the <b>.
Yet somehow after using htmlentities it's not bold.
So... it's magic?
Posts: 16
Time spent in forums: 5 h 4 m 6 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
Ok thank you for that. I have another question.
I use Greek letters as I said. When I write Greek letters and click save they are converted to Html chars. Is this will still work ?
and what you suggest me to use. htmlentities or htmlspecialchars ?