Eden Morris Posted January 3, 2011 Share Posted January 3, 2011 I need to take in HTML and insert it into a field. Is there a custom function that will replace all the HTML Character Entity Encoding? For example: name format © = © or numeric format © = © Ideally I'd have a substitute function for all of these, I'm hoping one already exists. Link to comment Share on other sites More sharing options...
Eden Morris Posted January 3, 2011 Author Share Posted January 3, 2011 Nevermind.... I just made it myself here's what I came up with. Substitute(HTML;[" ";" "];["©";"©"];["®";"®"];["²";"²"];["³";"³"];[""";"\""];["&";"&"];["<";"<"];[">";">"];["–";"–"];["—";"—"];["‘";"‘"];["’";"’"];["“";"\“"];["”";"\”"];["•";"•"];["†";"†"];["‡";"‡"];["′";"′"];["″";"\″"];["‹";"‹"];["›";"›"];["€";"€"];["™";"™"];["˜";"˜"];["ˆ";"ˆ"];["♠";"♠"];["♣";"♣"];["♥";"♥"];["♦";"♦"];["◊";"◊"];["←";"←"];["→";"→"];["↑";"↑"];["↓";"↓"];["↔";"↔"];["¬";"¬"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["­";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["&Uml;";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["­";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["Ü";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["Ü";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"]) Link to comment Share on other sites More sharing options...
comment Posted January 3, 2011 Share Posted January 3, 2011 What's the point of: Substitute(HTML; ... ["¡";"¡"] ... ) etc.? Link to comment Share on other sites More sharing options...
Eden Morris Posted January 3, 2011 Author Share Posted January 3, 2011 What's the point of: Substitute(HTML; ... ["¡";"¡"] ... ) etc.? oh! it looks like the forum has replaced my code with the actual characters! hmmm.... here it is as an RTF File.... HTML Char Enc Rep Func.rtf Link to comment Share on other sites More sharing options...
comment Posted January 3, 2011 Share Posted January 3, 2011 I see. This will make real trouble when posting xml code. Link to comment Share on other sites More sharing options...
Newbies oliver_at_ends Posted October 8, 2012 Newbies Share Posted October 8, 2012 Eden Morris, Thank you very much for posting this custom FileMaker function. I had cause to use it last week, so you have helped me out! However, I have found a couple of problems: 1. I can't copy and paste the following characters into FileMaker: "♠", "♣", "♥", "♦", "←", "→", "↑", "↓", "↔". They show up as squares, to me. 2. The string "&" needs to be replaced *last*, or it goes wrong. For example, the string "&lt;" should be decoded to "<". In your function, "&" is replaced with "&", so the string becomes "<". But then, later in the same function, "<" is replaced with "<", so the string becomes "<". This is not the correct behaviour. To prevent this from happening, the line ["&";"&"] needs to appear last in the list of substitutions. But thanks! Oliver Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 4216 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now