ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Thangalin via ntg-context <ntg-context@ntg.nl>
To: Mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Thangalin <thangalin@gmail.com>
Subject: Re: Typesetting unicode characters
Date: Thu, 31 Mar 2022 01:06:27 -0700	[thread overview]
Message-ID: <CAANrE7rQGFeOqZN7dkX3TPbaYGQSWo=+Wb7gef8wFhwhj7t+Bg@mail.gmail.com> (raw)
In-Reply-To: <YkQLQ1t5oQa9/HSy@phare.normalesup.org>


[-- Attachment #1.1: Type: text/plain, Size: 913 bytes --]

On the rare chance that someone else stumbles across this problem ...

By default, Java's Xalan transformer for creating XML documents does not
correctly encode emojis. Instead of &#x1F44D; for the thumbs up emoji,
Xalan encodes it as &#55357;&#56397;. As Arthur pointed out, this is not a
valid entity encoding.

One solution is to use Saxonica's Saxon 11 transformer, which produces the
expected output:

  <html>
    <head><meta charset="utf8"/></head>
    <body>
      <p id="caret">the 👍 emoji</p>
    </body>
  </html>

In Java, switching to Saxon entails installing the Jar files for Saxonica
and its resolvers. Then set the system property before invoking the XML
transformer: System.setProperty( "javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl" );

ConTeXt handles the emoji from the transformed XML file without any issues.

Thank you, Arthur.

[-- Attachment #1.2: Type: text/html, Size: 1227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2022-03-31  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30  7:32 Thangalin via ntg-context
2022-03-30  7:48 ` Arthur Rosendahl via ntg-context
2022-03-31  8:06   ` Thangalin via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAANrE7rQGFeOqZN7dkX3TPbaYGQSWo=+Wb7gef8wFhwhj7t+Bg@mail.gmail.com' \
    --to=ntg-context@ntg.nl \
    --cc=thangalin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).