WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with MSIE
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Convert HTML Hex to Unicode String

 Keywords:  Convert HTM HTML Hex Unicode String &# Character textarea InternetExplorer.Application innerhtml

Question:

Hello, I have been asked to compile some text that contains unicode and needs to be written to a file (htm). The text contains for example "Yönetim Danismanlik A.S." where i (ı) and S (Ş) are unicode characters. The source string is actually "Yönetim Danısmanlık A.Ş." which displays nicely on a web page

Long term I'm looking for a more universal method to convert unicode strings to winbatch hex codes and write them back to unicode htm files. The list shows a hex code of ı for the unicode character ı (i) and I figure the Winbatch hex is just low/high byte swapped (3101 vs. 0131 and 5E01 vs 015E). Is there possibly a UDF for both (convert ı to 0131)

Can enybody help?

Answer:

Here is an example that uses InternetExplorer object model
strTextHtmlEntities = "&#191;Hablas bien el espa&ntilde;ol? <<< Yönetim Dan&#305;smanl&#305;k A.&#350;. >>>"
objIE = ObjectOpen ("InternetExplorer.Application")
objIE.visible = @FALSE
objIE.navigate("about:blank")
objTA = objIE.Document.createElement("textarea")
objTA.innerHTML = StrReplace (StrReplace (strTextHtmlEntities, "<", "&lt;"), ">", "&gt;")
strTextUnicode = objTA.value
objIE.quit
objTA = 0
objIE = 0
ClipPut (strTextUnicode)
AskLine ("Decode Html entities", "Result", strTextUnicode, 1)

Article ID:   W18127
Filename:   Convert HTML Hex to Unicode String.txt
File Created: 2011:12:07:09:06:10
Last Updated: 2011:12:07:09:06:10