From e057193de0d3eb9370605cd8d67d6df1beeb1c7a Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 19 May 2012 01:21:18 -0500 Subject: [PATCH] Added function for converting html special characters. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With entities there are problems encoding characters in other languages, for example á, ó, in spanish will become special characters. --- laravel/html.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/laravel/html.php b/laravel/html.php index d1f199aa..109d459a 100644 --- a/laravel/html.php +++ b/laravel/html.php @@ -45,6 +45,19 @@ class HTML { return html_entity_decode($value, ENT_QUOTES, Config::get('application.encoding')); } + /** + * Convert HTML special characters. + * + * The encoding specified in the application configuration file will be used. + * + * @param string $value + * @return string + */ + public static function specialchars($value) + { + return htmlspecialchars($value, ENT_QUOTES, Config::get('application.encoding'), false); + } + /** * Generate a link to a JavaScript file. *