Last active
January 11, 2020 01:40
-
-
Save JamoCA/8787000b1905babb62ca6da68e6eff8e to your computer and use it in GitHub Desktop.
Testing Emojis with ColdFusion, but ran into ColdFusion error when configuring a value for the unit test. CF doesn't like the pound-sign keycap emoji.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 20200110 Testing Emojis with ColdFusion, but ran into ColdFusion error when configuring a value for the unit test. | |
CF doesn't like the pound-sign keycap emoji. | |
Using keycap variant https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)#Variants | |
Blog Entry: https://dev.to/gamesover/basic-latin-emoji-style-pound-sign-is-reserved-1he9 | |
Test using TryCF or your own server | |
https://www.trycf.com/gist/8787000b1905babb62ca6da68e6eff8e ---> | |
<fieldset><legend>Outputting as regular strings works:</legend> | |
<p>#️⃣ *️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣</p> | |
</fieldset> | |
<fieldset><legend>Using CFSaveContent works</legend> | |
<p>NOTE: If emoji is within CFOUTPUT, the # emoji will throw an error.</p> | |
<cfsavecontent variable="test">#️⃣ *️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣</cfsavecontent> | |
<cfoutput> | |
<p>#Test#</p> | |
</cfoutput> | |
</fieldset> | |
<fieldset><legend>Using CFSaveContent without CFOUTPUT to define the variable</legend> | |
<cfsavecontent variable="emojiPound">#️⃣</cfsavecontent> | |
<cfset test = "#emojiPound# *️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣"> | |
<cfoutput> | |
<p>#test#</p> | |
</cfoutput> | |
</fieldset> | |
<fieldset><legend>Using CFSET throws a ColdFusion error (in CF2016/2018 and Lucee)</legend> | |
<p>I believe ColdFusion is failing to parse the "#" emoji. If "#" is removed, it works. Do I need to use double-emojis? (j/k)</p> | |
<i style="color:red;">Edit source code and unrem the CFSET statement (CF parsing throws an error)</i> | |
<!--- | |
<cfset test = "#️⃣ *️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣"> | |
---> | |
</fieldset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment