Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Converting HTML entities to Unicode Characters Expand / Collapse
Author
Message
Posted Monday, October 29, 2012 7:18 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 12:47 AM
Points: 309, Visits: 123
Hi Experts,

I am here with another question. I have a string where i have some HTML entities in between string(Please find the HTML entities below). I need to convert that to Unicode Character. Please help me in resolving this problem.

ü
ñ
Í
è
ë
Ó
Ú
á
º
°
ò
í

Ñ



ó
É
é


Á
ú



Thanks in Advance.

Regards,

Vijay
Post #1378238
Posted Monday, October 29, 2012 7:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:55 AM
Points: 12,905, Visits: 32,165
i played with something similar, where i was converting from xml/html entities to the unicode? character char definition.

the problem was i was using a recursive function, and the #of recursion levels is limited to 100, but of course there are more html entities than that that are defined.

because of limitations in the forum, you cannot paste html entities; they get displayed instead, which makes pasting code pointless for issues like this.

take a look at this Inline Table Valued Function i played with a while ago; it does most of what you want.
XML_To_ASCII.txt

(note the array of possible values in the function is the complete list...to get it to work, you need to remove/comment out some of the values so there are only 100 items to replace--much easier to edit and comment out than try to add in something that was missing but you need.)


thinking about it deeper, i think the right thing to do would be to create two or more functions, so each one can do 100 find/replaces, until the whole possible collection of html entities are replaced.

here's a list of all the entities for refernece:
http://www.w3schools.com/tags/ref_entities.asp


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1378254
Posted Monday, October 29, 2012 8:09 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 12:47 AM
Points: 309, Visits: 123
Thanks a lot Lowell.

Regards,

Vijay
Post #1378262
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse