html_entity_decode
html_entity_decode
$temp = "<font class='red font-price'> 30 </font>";
echo html_entity_decode($temp);
html_entity_decode
html_entity_decode
$temp = "<font class='red font-price'> 30 </font>";
echo html_entity_decode($temp);
html entity decode in sql query
DECLARE @htmlNames TABLE
(
ID INT IDENTITY(1,1),
asciiDecimal INT,
htmlName varchar(50)
);
INSERT INTO @htmlNames
VALUES
(34,'"'),
(38,'&'),
(60,'<'),
(62,'>'),
(160,' '),
(161,'¡'),
(162,'¢')
;
DECLARE @inputString varchar(max)= '&test"<String>"&';
DECLARE @resultString varchar(max) = @inputString;
-- Simple HTML-decode:
SELECT
@resultString = Replace(@resultString COLLATE Latin1_General_CS_AS, htmlName, NCHAR(asciiDecimal))
FROM
@htmlNames
;
SELECT @resultString;
-- Output: &test"<String>"&
-- Multiple HTML-decode:
SET @resultString = @inputString;
DECLARE @temp varchar(max) = '';
WHILE @resultString != @temp
BEGIN
SET @temp = @resultString;
SELECT
@resultString = Replace(@resultString COLLATE Latin1_General_CS_AS, htmlName, NCHAR(asciiDecimal))
FROM
@htmlNames
;
END;
SELECT @resultString;
-- Output: &test"<String>"&
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us