% test-bm-pu-licr.tex
%
% Function:
% * Test for LICRs in Unicode bookmarks,
%   see table 7.33 "Standard LICR objects",
%   "The TeX LaTeX Companion", 2nd ed.
%
% Copyright (c) 2008 by Heiko Oberdiek.
%
% This file is part of the `Hyperref Bundle'.
% -------------------------------------------
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any later
% version. The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2005/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Heiko Oberdiek.
%
% The list of all files belonging to the `Hyperref Bundle' is
% given in the file `manifest.txt'.
%
% Please send error reports and suggestions for improvements to
%   Heiko Oberdiek <heiko.oberdiek at googlemail.com>.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{test-bm-pu-licr.tex}%
  [2008/09/11 v1.0 Test LICRs in bookmark strings (HO)]
\documentclass[a4paper]{article}
\usepackage[
  hmargin=15mm,
  vmargin={10mm,15mm},
]{geometry}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage{pdfescape}[2007/04/21]
\usepackage[unicode]{hyperref}
\usepackage{bookmark}

\makeatletter
\newcommand*{\X}{%
  \begingroup
    \let\do\@makeother
    \dospecials
    \catcode`\{=1 %
    \catcode`\}=2 %
    \@X
}
\newcommand*{\@X}[1]{%
    \xdef\TestString{\detokenize{#1}}%
  \endgroup
  \everyeof{\noexpand}%
  \scantokens{\toks0={#1}}%
  \begingroup
    \edef\x{\endgroup
      \noexpand\XXX{\the\toks@}%
    }%
  \x
}
\newcounter{bm}
\newcommand*{\XXX}[1]{%
  \stepcounter{bm}%
  \begingroup
    \let\textvisiblespace\relax
    \let\textbackslash\relax
    \let\%\relax
    \edef\TestString{\FormatTestString\TestString}%
    \edef\TestString{\FormatBS\TestString}%
    \edef\TestString{\FormatP\TestString}%
  \expandafter\endgroup
  \expandafter\pdfbookmark\expandafter{\TestString: #1}{\thebm}%
  \texttt{\FormatTestString\TestString}&
  #1&
  \pdfstringdef\TestPdfString{#1}%
  \@XX
}
\newcommand*{\@XX}[1]{%
  \EdefUnescapeString\TestUnescapeString\TestPdfString
  \EdefEscapeHex\TestHexString\TestUnescapeString
  \FormatHexString\TestHexString
  \global\let\TestHexString\TestHexString
  \@onelevel@sanitize\TestHexString
  \edef\CompareHexString{\zap@space FEFF#1 \@empty}%
  \@onelevel@sanitize\CompareHexString
  \ifx\TestHexString\CompareHexString
  \else
    \begingroup
      \def\HexSep{ }%
      \PackageError{TEST}{%
        Failed: \TestString\MessageBreak
        \GroupHexString\TestHexString\MessageBreak
        \GroupHexString\CompareHexString
      }\@ehc
    \endgroup
  \fi
  \tabularnewline
}
\newcommand*{\FormatTestString}[1]{%
  \expandafter\@FormatTestString#1 \@nil
}
\def\@FormatTestString#1 #2\@nil{%
  #1%
  \ifx\\#2\\%
  \else
    \textvisiblespace
    \@FormatTestString #2\@nil
  \fi
}
\newcommand*{\FormatBS}[1]{%
  \expandafter\expandafter\expandafter\@FormatBS
  \expandafter#1\@backslashchar\@nil
}
\expandafter\def\expandafter\@FormatBS
\expandafter#\expandafter1\@backslashchar#2\@nil{%
  #1%
  \ifx\\#2\\%
  \else
    \textbackslash
    \@FormatBS #2\@nil
  \fi
}
\newcommand*{\FormatP}[1]{%
  \expandafter\expandafter\expandafter\@FormatP
  \expandafter#1\@percentchar\@nil
}
\expandafter\def\expandafter\@FormatP
\expandafter#\expandafter1\@percentchar#2\@nil{%
  #1%
  \ifx\\#2\\%
  \else
    \%%
    \@FormatP #2\@nil
  \fi
}
\newcommand*{\GroupHexString}[1]{%
  \expandafter\StartGroupHexString#1\@empty\@empty\@empty\@empty
  \@empty\@empty\@empty\@empty
  \@nil
}
\def\StartGroupHexString#1#2#3#4#5#6#7#8#9\@nil{%
  \ifx#5\@empty
  \else
    \HexGroup{#5#6#7#8}%
    \DoGroupHexString#9\@empty\@empty\@empty
  \fi
}
\def\DoGroupHexString#1#2#3#4{%
  \ifx#1\@empty
  \else
    \HexSep
    \HexGroup{#1#2#3#4}%
    \expandafter\DoGroupHexString
  \fi
}
\newcommand*{\HexGroup}[1]{#1}
\newcommand*{\FormatHexString}[1]{%
  \texttt{%
    \def\HexSep{\,}%
    \GroupHexString{#1}%
  }%
}
\makeatother
  
\begin{document}
\endlinechar=-1 %
\begin{longtable}{@{}lll@{}}
% page 455
\X{ABCDEFGHIJ}{0041 0042 0043 0044 0045 0046 0047 0048 0049 004A}
\X{KLMNOPQRST}{004B 004C 004D 004E 004F 0050 0051 0052 0053 0054}
\X{UVWXYZ}{0055 0056 0057 0058 0059 005A}
\X{abcdefghij}{0061 0062 0063 0064 0065 0066 0067 0068 0069 006A}
\X{klmnopqrst}{006B 006C 006D 006E 006F 0070 0071 0072 0073 0074}
\X{uvwxyz}{0075 0076 0077 0078 0079 007A}
\X{0123456789}{0030 0031 0032 0033 0034 0035 0036 0037 0038 0039}
\X{@}{0040}
\X{.,/}{002E 002C 002F}
\X{;:?!"`'}{003B 003A 003F 0021 0022 0060 0027}
\X{*+-=()[|]}{002A 002B 002D 003D 0028 0029 005B 007C 005D}
\X{\#\&\%}{0023 0026 0025}
\X{\"{}}{00A8}% *
\X{\"A}{00C4}
\X{\"E}{00CB}
\X{\"I}{00CF}
\X{\"O}{00D6}
\X{\"U}{00DC}
\X{\"Y}{0178}
\X{\"a}{00E4}
% page 456
\X{\"e}{00EB}
\X{\"\i}{00EF}
\X{\"i}{00EF}
\X{\"o}{00F6}
\X{\"u}{00FC}
\X{\"y}{00FF}
\X{\$}{0024}
\X{\'{}}{00B4}% *
\X{\'A}{00C1}
\X{\'C}{0106}
\X{\'E}{00C9}
\X{\'I}{00CD}
\X{\'L}{0139}
\X{\'N}{0143}
\X{\'O}{00D3}
\X{\'R}{0154}
\X{\'S}{015A}
\X{\'U}{00DA}
\X{\'Y}{00DD}
\X{\'Z}{0179}
\X{\'a}{00E1}
\X{\'c}{0107}
\X{\'e}{00E9}
\X{\'\i}{00ED}
\X{\'i}{00ED}
\X{\'l}{013A}
\X{\'n}{0144}
\X{\'o}{00F3}
\X{\'r}{0155}
\X{\'s}{015B}
\X{\'u}{00FA}
\X{\'y}{00FD}
\X{\'z}{017A}
\X{\.{}}{02D9}% *
\X{\.I}{0130}
\X{\.Z}{017B}
\X{\.\i}{0069}
\X{\.i}{0069}
\X{\.z}{017C}
\X{\={}}{00AF}
% page 457
\X{\AE}{00C6}
\X{\DH}{00D0}
\X{\DJ}{0110}
\X{\H{}}{02DD}% *
\X{\H O}{0150}
\X{\H U}{0170}
\X{\H o}{0151}
\X{\H u}{0171}
\X{\L}{0141}
\X{\NG}{014A}
\X{\O}{00D8}
\X{\OE}{0152}
\X{\P}{00B6}
\X{\S}{00A7}
\X{\SS}{0053 0053}
\X{\TH}{00DE}
\X{\^{}}{005E}% *
\X{\^A}{00C2}
\X{\^E}{00CA}
\X{\^I}{00CE}
\X{\^J}{0134}
\X{\^O}{00D4}
\X{\^U}{00DB}
\X{\^a}{00E2}
\X{\^e}{00EA}
\X{\^\i}{00EE}
\X{\^i}{00EE}
\X{\^\j}{0135}
\X{\^o}{00F4}
\X{\^u}{00FB}
\X{\_}{005F}
\X{\`{}}{0060}
\X{\`A}{00C0}
\X{\`E}{00C8}
\X{\`I}{00CC}
\X{\`O}{00D2}
\X{\`U}{00D9}
\X{\`a}{00E0}
\X{\`e}{00E8}
\X{\`\i}{00EC}
\X{\`i}{00EC}
\X{\`o}{00F2}
% page 458
\X{\`u}{00F9}
\X{\ae}{00E6}
\X{\b{}}{0020 0331}% * 
\X{ \b{}}{0020 0020 0331}%+
\X{\c{}}{00B8}% *
\X{\c C}{00C7}
\X{\c S}{015E}
\X{\c T}{0162}
\X{\c c}{00E7}
\X{\c s}{015F}
\X{\c t}{0163}
\X{\capitalacute{}}{00B4}% *
\X{\capitalbreve{}}{02D8}% *
\X{\capitalcaron{}}{02C7}% *
\X{\capitalcedilla{}}{00B8}% *
\X{\capitalcircumflex{}}{005E}% *
\X{\capitaldieresis{}}{00A8}% *
\X{\capitaldotaccent{}}{02D9}% *
\X{\capitalgrave{}}{0060}% *
\X{\capitalhungarumlaut{}}{02DD}% *
\X{\capitalmacron{}}{00AF}% *
\X{\capitalnewtie{}}{0020 0311}% *
\X{\capitalogonek{}}{02DB}% *
\X{\capitalring{}}{02DA}% *
\X{\capitaltie{}}{0020 0361}% *
\X{\capitaltilde{}}{02DC}% *
\X{\d{}}{0020 0323}% *
\X{\dag}{2020}
\X{\ddag}{2021}
\X{\dh}{00F0}
\X{\dj}{0111}
\X{\dots}{2026}
\X{\guillemotleft}{00AB}
\X{\guillemotright}{00BB}
\X{\guilsinglleft}{2039}
\X{\guilsinglright}{203A}
\X{\i}{0131}
\X{\j}{0237}
\X{\k{}}{02DB}% *
\X{\k A}{0104}
\X{\k E}{0118}
\X{\k O}{01EA}
\X{\k a}{0105}
\X{\k e}{0119}
\X{\k o}{01EB}
\X{\l}{0142}
\X{\ng}{014B}
% page 459
\X{\o}{00F8}
\X{\oe}{0153}
\X{\pounds}{00A3}
\X{\quotedblbase}{201E}
\X{\quotesinglbase}{201A}
\X{\r{}}{02DA}% *
\X{\r A}{00C5}
\X{\r U}{016E}
\X{\r a}{00E5}
\X{\r u}{016F}
\X{\ss}{00DF}
\X{\t{}}{0020 0361}% *
\X{\textacutedbl}{02DD}
% \X{\textascendercompwordmark}{}% ???
\X{\textasciiacute}{00B4}%
\X{\textasciibreve}{02D8}%
\X{\textasciicaron}{02C7}%
\X{\textasciicircum}{005E}
\X{\textasciidieresis}{00A8}
\X{\textasciigrave}{0060}
\X{\textasciimacron}{00AF}
\X{\textasciitilde}{007E}
\X{\textasteriskcentered}{002A}
\X{\textbackslash}{005C}
\X{\textbaht}{0E3F}
\X{\textbar}{007C}
\X{\textbardbl}{2016}
\X{\textbigcircle}{25EF}
\X{\textblank}{2422}
% \X{\textborn}{} ???
\X{\textbraceleft}{007B}
\X{\textbraceright}{007D}
\X{\textbrokenbar}{00A6}
\X{\textbullet}{2022}
% \X{\textcapitalcompwordmark}{}% ???
\X{\textcelsius}{2103}
\X{\textcent}{00A2}
% \X{\textcentoldstyle}{F7A2}% private use (adobe/glyphlist.txt)
\X{\textcircled{}}{25EF}% *
\X{\textcircledP}{2117}
% page 460
\X{\textcolonmonetary}{20A1}
\X{\textcompwordmark}{200C}
% \X{\textcopyleft}{}% not available
\X{\textcopyright}{00A9}
\X{\textcurrency}{00A4}
\X{\textdagger}{2020}
\X{\textdaggerdbl}{2021}
% \X{\textdblhyphen}{}% ???
% \X{\textdblhyphenchar}{}% ???
\X{\textdegree}{00B0}
% \X{\textdied}{}% ???
\X{\textdiscount}{2052}
\X{\textdiv}{00F7}
\X{\textdivorced}{26AE}
\X{\textdollar}{0024}
% \X{\textdollaroldstyle}{F724}% private use (adobe/glyphlist.txt)
\X{\textdong}{20AB}
\X{\textdownarrow}{2193}
% \X{\texteightoldstyle}{F738}% private use (adobe/glyphlist.txt)
\X{\textellipsis}{2026}
\X{\textemdash}{2014}
\X{\textendash}{2013}
\X{\textestimated}{212E}
\X{\texteuro}{20AC}
\X{\textexclamdown}{00A1}
% \X{\textfiveoldstyle}{F735}% private use (adobe/glyphlist.txt)
\X{\textflorin}{0192}
% \X{\textfouroldstyle}{F734}% private use (adobe/glyphlist.txt)
\X{\textfractionsolidus}{2044}
\X{\textgravedbl}{02F5}
\X{\textgreater}{003E}
\X{\textguarani}{20B2}
\X{\textinterrobang}{203D}
% \X{\textinterrobangdown}{}% ???
\X{\textlangle}{2329}
\X{\textlbrackdbl}{27E6}
% \X{\textleaf}{}% ???
\X{\textleftarrow}{2190}
\X{\textless}{003C}
\X{\textlira}{20A4}
% page 461
\X{\textlnot}{00AC}
\X{\textlquill}{2045}
\X{\textmarried}{26AD}
\X{\textmho}{2127}
\X{\textminus}{2212}
\X{\textmu}{00B5}
\X{\textmusicalnote}{266A}
\X{\textnaira}{20A6}
% \X{\textnineoldstyle}{F739}% private use (adobe/glyphlist.txt)
\X{\textnumero}{2116}
% \X{\textogonekcentered{}}{}% * ???, probably construct for "\k o" and "\k O"
\X{\textohm}{2126}
\X{\textonehalf}{00BD}
% \X{\textoneoldstyle}{F731}% private use (adobe/glyphlist.txt)
\X{\textonequarter}{00BC}
\X{\textonesuperior}{00B9}
\X{\textopenbullet}{25E6}
\X{\textordfeminine}{00AA}
\X{\textordmasculine}{00BA}
\X{\textparagraph}{00B6}
\X{\textperiodcentered}{00B7}
\X{\textpertenthousand}{2031}
\X{\textperthousand}{2030}
\X{\textpeso}{20B1}
% \X{\textpilcrow}{}% not available, U+00B6 PILCROW SIGN has two lines
\X{\textpm}{00B1}
\X{\textquestiondown}{00BF}
\X{\textquotedbl}{0022}
\X{\textquotedblleft}{201C}
\X{\textquotedblright}{201D}
\X{\textquoteleft}{2018}
\X{\textquoteright}{2019}
\X{\textquotesingle}{0027}
% \X{\textquotestraightbase}{201A}% ??? (not straight)
% \X{\textquotestraightdblbase}{201E}% ??? (not straight)
\X{\textrangle}{232A}
\X{\textrbrackdbl}{27E7}
\X{\textrecipe}{211E}
\X{\textreferencemark}{203B}
\X{\textregistered}{00AE}
% page 462
\X{\textrightarrow}{2192}
\X{\textrquill}{2046}
\X{\textsection}{00A7}
\X{\textservicemark}{2120}
% \X{\textsevenoldstyle}{F737}% private use (adobe/glyphlist.txt)
% \X{\textsixoldstyle}{F736}% private use (adobe/glyphlist.txt)
\X{\textsterling}{00A3}
\X{\textsurd}{221A}
% \X{\textthreeoldstyle}{F733}% private use (adobe/glyphlist.txt)
\X{\textthreequarters}{00BE}
% \X{\textthreequartersemdash}{}% ???
\X{\textthreesuperior}{00B3}
\X{\texttildelow}{02F7}
\X{\texttimes}{00D7}
\X{\texttrademark}{2122}
% \X{\texttwelveudash}{}% ???
% \X{\texttwooldstyle}{F732}% private use (adobe/glyphlist.txt)
\X{\texttwosuperior}{00B2}
\X{\textunderscore}{005F}
\X{\textuparrow}{2191}
\X{\textvisiblespace}{2423}
\X{\textwon}{20A9}
\X{\textyen}{00A5}
% \X{\textzerooldstyle}{F730}% private use (adobe/glyphlist.txt)
\X{\th}{00FE}
\X{\u{}}{02D8}% *
\X{\u A}{0102}
\X{\u G}{011E}
\X{\u a}{0103}
\X{\u g}{011F}
\X{\v{}}{02C7}% *
\X{\v C}{010C}
\X{\v D}{010E}
\X{\v E}{011A}
\X{\v L}{013D}
\X{\v N}{0147}
\X{\v R}{0158}
\X{\v S}{0160}
\X{\v T}{0164}
\X{\v Z}{017D}
% page 463
\X{\v c}{010D}
\X{\v d}{010F}
\X{\v e}{011B}
\X{\v l}{013E}
\X{\v n}{0148}
\X{\v r}{0159}
\X{\v s}{0161}
\X{\v t}{0165}
\X{\v z}{017E}
\expandafter\X\expandafter{\string\{}{007B}
\expandafter\X\expandafter{\string\}}{007D}
\X{\~{}}{02DC}
\X{\~A}{00C3}
\X{\~N}{00D1}
\X{\~O}{00D5}
\X{\~a}{00E3}
\X{\~n}{00F1}
\X{\~o}{00F5}
\end{longtable}
\end{document}
