UTF8 in TextField's 'default'
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 205
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Like https://github.com/ho-tex/hyperref/issues/5, LuaLaTeX produces an incorrect result if you use non-ASCII characters for 'default' in TextField.
It seems pdfLaTeX produces the correct result if you use only LATIN1-characters, but this problem occurs on pdfLaTeX too, if you use Japanese characters for 'default'.
The following hack fixes this problem.
(dank des Kommentars von Frau Fischer in https://github.com/ho-tex/hyperref/issues/5)
\documentclass{article}
\usepackage{fontspec} % ---- for LuaLaTeX
% \usepackage[utf8]{inputenc} % ---- for pdfLaTeX
\usepackage[unicode=true]{hyperref}
\usepackage[T1]{fontenc}
% FIX for 'default'
% See also the fix for 'value' by Frau Fischer
% ( https://github.com/ho-tex/hyperref/issues/5 ).
% I just replaced 'value' with 'default'.
\makeatletter
\define@key{Field}{default}{%
\Hy@pdfstringdef\Fld@default{#1}}
\makeatother
% NOTE:
% This fix IS needed for pdfLaTeX too, when you use Japanese
% characters.
%
% \documentclass{article}
% \usepackage[whole]{bxcjkjatype}
% \usepackage[utf8]{inputenc}
% \begin{document}
% \begin{Form}
% % without fix, fails to compile
% \TextField[name=addr,default=東京]{Address} %Tokyo
% \end{Form}
% \end{document}
\begin{document}
\begin{Form}
% OK, of course
\TextField[name=textfield1]{Address} \\
% OK
\TextField[name=textfield2,value=Köln]{Address} \\
% correct on pdfLaTeX (but incorrect if you use Japanese characters)
% incorrect without FIX on LuaLaTeX
\TextField[name=textfield3,default=München]{Address} \\
% (though this is probably meaningless)
% incorrect (internally) on LuaLaTeX
%
% $ pdftk pr-textfield-default-encoding.pdf dump_data_fields
% ...
% FieldValue: Köln % This is OK, but
% FieldValueDefault: München % Quatsch!
% ...
\TextField[name=textfield4,value=Köln,default=München]{Address}
\end{Form}
\end{document}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the provided minimal examples with LuaLaTeX and pdfLaTeX, then compare the behavior with the workaround shown in the issue and the related hyperref issue #5. Done means non-ASCII TextField default values, including Japanese characters, are encoded correctly without the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, tex
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100