Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Converting HTML entities to Unicode Characters


Converting HTML entities to Unicode Characters

Author
Message
vijay.singh 14112
vijay.singh 14112
Mr or Mrs. 500
Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)

Group: General Forum Members
Points: 507 Visits: 185
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
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14959 Visits: 38980
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

vijay.singh 14112
vijay.singh 14112
Mr or Mrs. 500
Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)Mr or Mrs. 500 (507 reputation)

Group: General Forum Members
Points: 507 Visits: 185
Thanks a lot Lowell.:-)

Regards,

Vijay
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search