January 3, 201115 yr 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.
January 3, 201115 yr Author Nevermind.... I just made it myself here's what I came up with. Substitute(HTML;[" ";" "];["©";"©"];["®";"®"];["²";"²"];["³";"³"];[""";"\""];["&";"&"];["<";"<"];[">";">"];["–";"–"];["—";"—"];["‘";"‘"];["’";"’"];["“";"\“"];["”";"\”"];["•";"•"];["†";"†"];["‡";"‡"];["′";"′"];["″";"\″"];["‹";"‹"];["›";"›"];["€";"€"];["™";"™"];["˜";"˜"];["ˆ";"ˆ"];["♠";"♠"];["♣";"♣"];["♥";"♥"];["♦";"♦"];["◊";"◊"];["←";"←"];["→";"→"];["↑";"↑"];["↓";"↓"];["↔";"↔"];["¬";"¬"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["­";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["&Uml;";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["­";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["Ü";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"];[" ";""];["¡";"¡"];["¢";"¢"];["£";"£"];["¤";"¤"];["¥";"¥"];["¦";"¦"];["§";"§"];["¨";"¨"];["©";"©"];["ª";"ª"];["«";"«"];["¬";"¬"];["";""];["®";"®"];["¯";"¯"];["°";"°"];["±";"±"];["²";"²"];["³";"³"];["´";"´"];["µ";"µ"];["¶";"¶"];["·";"•"];["¸";"¸"];["¹";"¹"];["º";"º"];["»";"»"];["¼";"¼"];["½";"½"];["¾";"¾"];["¿";"¿"];["À";"À"];["Á";"Á"];["Â";"Â"];["Ã";"Ã"];["Ä";"Ä"];["Å";"Å"];["Æ";"Æ"];["Ç";"Ç"];["È";"È"];["É";"É"];["Ê";"Ê"];["Ë";"Ë"];["Ì";"Ì"];["Í";"Í"];["Î";"Î"];["Ï";"Ï"];["Ð";"Ð"];["Ñ";"Ñ"];["Ò";"Ò"];["Ó";"Ó"];["Ô";"Ô"];["Õ";"Õ"];["Ö";"Ö"];["×";"×"];["Ø";"Ø"];["Ù";"Ù"];["Ú";"Ú"];["Û";"Û"];["Ü";"Ü"];["Ý";"Ý"];["Þ";"Þ"];["ß";"ß"];["à";"à"];["á";"á"];["â";"â"];["ã";"ã"];["ä";"ä"];["å";"å"];["æ";"æ"];["ç";"ç"];["è";"è"];["é";"é"];["ê";"ê"];["ë";"ë"];["ì";"ì"];["í";"í"];["î";"î"];["ï";"ï"];["ð";"ð"];["ñ";"ñ"];["ò";"ò"];["ó";"ó"];["ô";"ô"];["õ";"õ"];["ö";"ö"];["÷";"÷"];["ø";"ø"];["ù";"ù"];["ú";"ú"];["û";"û"];["ü";"ü"];["ý";"ý"];["þ";"þ"];["ÿ";"ÿ"])
January 3, 201115 yr Author 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
October 8, 201213 yr Newbies 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
Create an account or sign in to comment