# pdfbookmark does not work with special characters

I'm writing a document in English, but I also have some parts in other language.

I created my own style to change how the book class behaves, which also includes headings for chapter and chapter* environments. As part of this, in definition for chapter* I added the pdfbookmark command, so that all unnumbered chapters appear in the bookmark. Here is the definition:

\renewcommand{\@makeschapterhead}[1]{%
{%
\pdfbookmark[0]{#1}{#1}%
\parindent 0pt \Large%\bfseries
\interlinepenalty\@M%
\rule{0.666\textwidth}{0.5pt}%
\par%
{\spacedlowsmallcaps{#1}\hfill}%
\mbox{}\par%
\mbox{}\par%
\mbox{}\par%
}%
}


Everything works as I expected, except unnumbered chapters that contain special characters in their name, for example

\chapter*{Sa{ž}etak}


The problem here is with the third argument in the pdfbookmark command, which is something like a label for the bookmark. I tried attacking this problem from different angles, but nothing seems to work. Simple solution would be to remove the pdfbookmark command from the chapter* definition, and to add it manually for all unnumbered chapters, but I'm trying to find a more elegant solution.

One of the possible solutions that I haven't tried is to put something like

\RemoveAllNonASCII{#1}


as the third argument, but I don't know how to design a function like that.

Any idea how to solve this problem?

Here is the minimum working example:

mwe.tex

\documentclass{style}

\begin{document}

\author{Me}
\title{MWE}

\maketitle

% Bookmark works
\chapter*{Unnumbered chapter}

% Bookmark does not work
\chapter*{Unnumbered chapter Ž}

% Bookmark works
\chapter{Numbered chapter}

% Bookmarks works, even though we have Ž in the title
\chapter{Numbered chapter Ž}

\end{document}


style.cls

\LoadClass[a4paper,11pt,oneside]{book}

\usepackage{hyperref}
\usepackage{bookmark}

{%
\pdfbookmark[0]{#1}{#1}%
{#1}
}%
}

• What happens if you add an optional parameter to your \chapter*? \chapter*[Sazetak]{Sa{ž}etak}? – LokiRagnarok Sep 3 '19 at 15:42
• Thank you for your inputs, unfortunately they did not work. I added minimum working example. However, Ulrike Fischer proposed a solution that works. Thank you again! – Marko Gulin Sep 3 '19 at 16:41

\documentclass{article}

• Excellent idea, I've set \thepage as label for bookmarks (third argument in the pdfbookmark command), everything works fine now. Thank you! – Marko Gulin Sep 3 '19 at 16:47