{"id":48096,"date":"2020-02-27T03:01:44","date_gmt":"2020-02-26T17:01:44","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=48096"},"modified":"2020-02-26T15:37:34","modified_gmt":"2020-02-26T05:37:34","slug":"emoji-sms-and-emailing-large-data-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/emoji-sms-and-emailing-large-data-tutorial\/","title":{"rendered":"Emoji SMS and Emailing Large Data Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Emoji SMS and Emailing Large Data Tutorial'><img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/big_emoji_email.jpg\"  \/><\/a><p class=\"wp-caption-text\">Emoji SMS and Emailing Large Data Tutorial<\/p><\/div>\n<p>With the convenience and ease of user interaction the HTML textarea element offers, as you can try with yesterday&#8217;s <a title='Emoji SMS and Emailing Tutorial' href='#esmset'>Emoji SMS and Emailing Tutorial<\/a>, there is added responsibility on the programmer to cater for an adventurous user &#8220;stretching the friendship&#8221; and entering huge amounts of data into that generous &#8220;textarea&#8221; pallette.<\/p>\n<p>Even window.localStorage can&#8217;t help here on this so far exclusively &#8220;client&#8221; (ie. just HTML\/Javascript\/CSS) web application because &#8220;client email&#8221; and\/or &#8220;client SMS&#8221; still have that length limitation that avoids the dreaded &#8220;Bad Request&#8221; (error 400) when the amount of user entered data into that provided textarea goes beyond about 800 characters (at least for our rjmprogramming.com.au domain).<\/p>\n<p>So to progress here with large data scenarios, and yet still &#8220;feel client&#8221; here with this web application, we embed calls to PHP with an HTML iframe (name=[iframeName]) element, populated via an HTML form method=POST target=[iframeName] action=[inlineHTMLemailPHPhelper].  We&#8217;ve done all this before, so, is there anything new to discuss?  You bet there is, and it is to do with emoji data.  You see, in the <font color=blue>subject line<\/font> &#8230;<\/p>\n<p><code><br \/>\n&lt;form id=ifemail target=\"iemail\" style=\"display:none;\" action=\"\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php\" method=\"POST\"&gt;<br \/>\n&lt;input type=hidden style=display:none; name=inline value=\"\"&gt;&lt;\/input&gt;<br \/>\n&lt;input type=hidden style=display:none; name=to id=tdto value=\"\"&gt;&lt;\/input&gt;<br \/>\n<font color=blue>&lt;input type=hidden style=display:none; name=subj id=tdsubj value=\"Name Your Mascot - RJM Programming\"&gt;&lt;\/input&gt;<\/font><br \/>\n<font color=purple>&lt;textarea name=hcont style=display:none; value=\"\" id=tdhuhta cols=80 rows=30&gt;&lt;\/textarea&gt;<\/font><br \/>\n&lt;input type=hidden style=display:none; name=cc id=tdcc value=\"\"&gt;&lt;\/input&gt;<br \/>\n&lt;input type=hidden style=display:none; name=bcc id=tdbcc value=\"\"&gt;&lt;\/input&gt;<br \/>\n&lt;input style=display:none; type=submit id=fsubm value=\"Email\"&gt;&lt;\/input&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;iframe style=display:none; name=iemail id=iemail src=\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php&gt;&lt;\/iframe&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; emojis all work at the destination email, but those same emoji forms in <font color=purple>the email body section, as HTML<\/font> caused gobbledygook data at the resultant email.  We got <font color=red>great advice<\/font> from <a target=_blank title='Useful link, thanks' href='https:\/\/stackoverflow.com\/questions\/18749591\/encode-html-entities-in-javascript'>this useful link<\/a>, thanks &#8230;<\/p>\n<p><code><br \/>\n\/**<br \/>\n * Convert a string to HTML entities ... thanks to https:\/\/stackoverflow.com\/questions\/18749591\/encode-html-entities-in-javascript<br \/>\n *\/<br \/>\nString.prototype.toHtmlEntities = function() {<br \/>\n    return this.replace(\/.\/gm, function(s) {<br \/>\n        \/\/ return \"&amp;#\" + s.charCodeAt(0) + \";\";<br \/>\n        return (s.match(\/[a-z0-9\\s]+\/i)) ? s : \"&amp;#\" + s.charCodeAt(0) + \";\";<br \/>\n    });<br \/>\n};<br \/>\n<br \/>\n\/**<br \/>\n * Create string from HTML entities<br \/>\n *\/<br \/>\n<font color=red>String.fromHtmlEntities = function(string) {<br \/>\n    return (string+\"\").replace(\/&amp;#\\d+;\/gm,function(s) {<br \/>\n        return String.fromCharCode(s.match(\/\\d+\/gm)[0]);<br \/>\n    })<br \/>\n};<\/font><br \/>\n<\/code><\/p>\n<p> &#8230; to come up with the codeline to fix those emojis within the textarea element arriving properly at the output email via &#8230;<\/p>\n<p><code><br \/>\n     document.getElementById('tdhuhta').innerHTML='&lt;html&gt;&lt;body&gt;&lt;div&gt;' + <font color=red>String.fromHtmlEntities(<\/font>document.getElementById('mybody').value<font color=red>)<\/font> + '&lt;\/div&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n<\/code><\/p>\n<p> &#8230; you can see happening with <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html--GETME' title='name_your.html'>the changed<\/a> <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html--GETME' title='name_your.html'>name_your.html<\/a>&#8216;s <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Click picture'>live run<\/a> link, for your perusal.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/emoji-sms-and-emailing-large-data-tutorial\/'>Emoji SMS and Emailing Large Data Tutorial<\/a>.<\/p-->\n<hr>\n<p id='esmset'>Previous relevant <a target=_blank title='Emoji SMS and Emailing Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/emoji-sms-and-emailing-tutorial\/'>Emoji SMS and Emailing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Emoji SMS and Emailing Tutorial'><img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your_more.jpg\"  \/><\/a><p class=\"wp-caption-text\">Emoji SMS and Emailing Tutorial<\/p><\/div>\n<p>The recent <a title='Emoji Emailing Primer Tutorial' href='#eept'>Emoji Emailing Primer Tutorial<\/a>, it being a sharing web application pointing at client &#8230;<\/p>\n<ul>\n<li>email &#8230; is a doddle to add &#8230;<\/li>\n<li>SMS<\/li>\n<\/ul>\n<p> &#8230; functionality onto because of all the commonalities between using &#8220;a&#8221; link &#8220;mailto:&#8221; URLs versus &#8220;a&#8221; link &#8220;sms:&#8221; URLs.  But just because you can, should you?  In our view, yes, because SMS represents a more immediate and often, a briefer, form of communication, versus the use of email.<\/p>\n<p>To simulate the &#8220;body&#8221; section of either email or SMS the best HTML element to use is the <a target=_blank title='HTML textarea information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_textarea.asp'>textarea<\/a> as being the closest thing to a classroom blackboard (or old fashioned whiteboard) for textual data.  That textual data doesn&#8217;t have to be just the characters and numbers and other special keyboard characters.  It can include <a target=_blank title='Emoji information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Emoji'>emoji<\/a> characters where imagery meets text writing, as a way to enhance your communications.  The <a target=_blank title='HTML textarea information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_textarea.asp'>textarea<\/a> element allows you to include a paragraphing feel to your writing, as ascii code 10 allows you to add line feeds into the mix.<\/p>\n<p>A tiny annoyance with client SMS, compared to email, is the lack of a &#8220;subject&#8221; data item, so we just prefix what an email subject would be to the top of an SMS body section, as you can see happening with <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html-GETME' title='name_your.html'>the changed<\/a> <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html-GETME' title='name_your.html'>name_your.html<\/a>&#8216;s <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Click picture'>live run<\/a> link.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/emoji-sms-and-emailing-primer-tutorial\/'>Emoji SMS and Emailing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='eept'>Previous relevant <a target=_blank title='Emoji Emailing Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/emoji-emailing-primer-tutorial\/'>Emoji SMS and Emailing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Emoji Emailing Primer Tutorial'><img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_email.jpg\"  \/><\/a><p class=\"wp-caption-text\">Emoji Emailing Primer Tutorial<\/p><\/div>\n<p>You can get your point across in many ways, especially in our digital age, if the means are there to make a connection.  We like email a lot, and for amusement, <a target=_blank href='https:\/\/en.wikipedia.org\/wiki\/Emoji' title='Emoji information from Wikipedia ... thanks'>Emoji<\/a> characters can be a good way to communicate in that &#8220;cut through&#8221; way.<\/p>\n<p>In today&#8217;s HTML and Javascript web application we allow you to team up with your chosen &#8220;mascot&#8221; Emoji, give it a name, and email somebody with your news.<\/p>\n<p>Pretty simple really, and as long as you don&#8217;t mind the small size of Emoji they have three big advantages over attached documents for emailing &#8230;<\/p>\n<ol>\n<li>they can be included in the Subject line as well<\/li>\n<li>they can be sprinkled in amongst your email Body (and Subject) at exact positions to suit your needs<\/li>\n<li>they cross over language barriers, quite often<\/li>\n<\/ol>\n<p>Because we use the <a target=_blank title='Mailto information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tryit.asp?filename=tryhtml_link_mailto'><i>mailto<\/i><\/a> HTML <a target=_blank title='HTML a tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_a.asp'>a<\/a> tag (though it is styled to look a lot like a button) method of sending the email it will send you to your email client, where, before sending, you can amend or add to the email, and there are often email client means to add Emojis there as well.<\/p>\n<p>A very useful resource we used (a lot) to create this web application, was this <a target=_blank title='Emoji useful link ... thanks' href='http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-6c-other-additional-symbols'>useful link<\/a>, so, thanks.<\/p>\n<p>In today&#8217;s HTML and Javascript programming source code you could call <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html_GETME' title='name_your.html'>name_your.html<\/a> we literally copied Emoji from the link above in between the &gt; and &lt; of the HTML select tag&#8217;s option tags, to make it happen.  Feel free to try a <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/name_your.html' title='Click picture'>live run<\/a>, and see for yourself.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d18286' onclick='var dv=document.getElementById(\"d18286\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/emoji\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d18286' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d48090' onclick='var dv=document.getElementById(\"d48090\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/sms\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d48090' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d48096' onclick='var dv=document.getElementById(\"d48096\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/php\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d48096' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>With the convenience and ease of user interaction the HTML textarea element offers, as you can try with yesterday&#8217;s Emoji SMS and Emailing Tutorial, there is added responsibility on the programmer to cater for an adventurous user &#8220;stretching the friendship&#8221; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/emoji-sms-and-emailing-large-data-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,29,37],"tags":[155,212,1604,1709,380,385,576,652,3240,932,1133,1137,1159,2086,1254,1262],"class_list":["post-48096","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-body","tag-client","tag-collaboration","tag-communication","tag-email","tag-emoji","tag-html","tag-javascript","tag-mascot","tag-php","tag-share","tag-sharing","tag-sms","tag-subject","tag-text","tag-textarea"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48096"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=48096"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48096\/revisions"}],"predecessor-version":[{"id":48104,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48096\/revisions\/48104"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=48096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=48096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=48096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}