As it is a Festive Break 🎄 I've had the opportunity to test this calendar import and find out what is really going on...

I created a simple test script to generate a single calendar entry from noon to 2pm tomorrow. The day after the ICS feed is accessed.

#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; use lib "$ENV{'DOCUMENT_ROOT'}/../lib"; use open ":std", ":encoding(UTF-8)"; use Site::Utils; my $template = Template->new(INCLUDE_PATH => $Site::Variables::temp +late_path); $data{'format'} = 'calendar' unless $data{'format'} eq 'plain'; print "Content-type: text/$data{'fomat'}; charset=utf-8;\n\n"; #print "\x{feff}"; # BOM my ($date, $uid) = $dbh->selectrow_array("SELECT DATE_FORMAT(NOW() + I +NTERVAL 1 DAY, '%Y%m%d'), DATE_FORMAT(NOW(), '%Y-%j-%H%i%s')"); if ($data{'template'}) { $template->process("admin/google/dogface.tt", $vars)or die $templa +te->error; exit; } print<<"END"; BEGIN:VCALENDAR VERSION:2.0 PRODID:Pawsies Calendar 1.0//EN CALSCALE:GREGORIAN METHOD:PUBLISH BEGIN:VEVENT SUMMARY:\x{1f436} Dog Face Test UID:DFT$uid\@pawsies.uk SEQUENCE:1 DTSTAMP:${date}T120000 DTSTART:${date}T120000 DTEND:${date}T140000 END:VEVENT END:VCALENDAR END

The module Site::Utils provides the database handle $dbh and splits the HTTP query string and puts it into %data.

If the BOM is included, Google Calendar doesn't display the entry at all. With the BOM omitted, the entry is displayed.

But, if we print the ICS data directly from the script, the 🐶 emoji is displayed correctly. If we use Template to handle the printing, instead of 🐶 we get the literal \x{1f436}... So, it appears to be Template that is not printing the Unicode characters.

Try it here:
Printing from script
Printing with Template

Of course, knowing where the problem exists is different to being able to solve it...

Do you have any experience of printing Unicode using Template?


In reply to Template and Unicode (was: Re: Another Unicode/emoji question) by Bod
in thread Another Unicode/emoji question by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.