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.
Take your business to the next level, with "The
Edge of Success: 9 Building Blocks to Double Your Sales."
Inside, you will discover how to easily capture more leads,
get repeat sales, and significantly grow your business.
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: 7,482
Time spent in forums: 4 Months 1 Week 6 Days 23 h 45 m
Reputation Power: 5807
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 ?
Create the Optimal Architecture for your Critical Applications Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.
Gartner Magic Quadrant for Application Delivery Controllers Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.
Knowledge is Power What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.
Rationalizing the Multi-Tool Environment The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.