[Tex/LaTex] Trouble importing unicode/emoji characters into a latex document

unicode

I am trying to import ᚊ (U+168A) and πŸ•™(U+1F55A) into a Latex document I have tried using

\DeclareUnicodeCharacter{}{}

to no avail, I have to use ShareLatex as it is the only why all of the members of this project can work on this report at the same time.

In my preamble I have put

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

Is there any way for me to use these characters in the document?

Best Answer

[the answer for pdflatex – below, first the answer IMHO best in the long run]

As I see in the first result of "g sharelatex", it's an online LaTeX editor. But what is the TeX engine it uses? Is XeTeX/XeLaTeX available in it?

That's worth clarifying, because if so, then the best solution would be to use XeLaTeX and just type the desired characters as they are, probably switching to a font that contains them. In such a case, the [relevant piece of] preamble would look like:

\documentclass{article}

\usepackage{xltxtra}
\newfontface\emojiFont {Some-Font-with-emoji-etc}

% if the main font doesn't contain those characters, add:
\catcode `\ᚊ=\active
\protected\def ᚊ{\leavevmode{\emojiFont ᚊ}}
\catcode `\πŸ•š=\active
\protected\def πŸ•š{\leavevmode{\emojiFont πŸ•š}}


\begin{document}

ᚊ

πŸ•š

\end{document}

However, if there's only some ancient pre-Unicode TeX engine available, and you really really really do not want to, or really really really cannot switch to XeTeX/XeLaTeX or LuaTeX/LuaLaTeX and avoid further Unicode-related troubles in the future, then: [the pdflatex answer]

\documentclass{article}

\usepackage[utf8]{inputenc}


\DeclareUnicodeCharacter {168A} {\combUp}
\DeclareUnicodeCharacter {1F55A} {\clockTen}

\protected\def \combUp {<<Comb-UP, U+168A>>}
\protected\def \clockTen {<<Clock Ten, U+1F55A>>}


\begin{document}

ᚊ

πŸ•š

\end{document}

Of course, you should define those \combUp and \clockTen to typeset respective char from a font that contains it. The definitions have to be robust, be it via the \protected primitive, or via LaTeX \DeclareRobustCommand (the latter is more tricky and robust only in the β€œrobusted” LaTeX contexts).