[issue:248] regexpatch: error on (u)pTeX with Japanese char

Hironobu Yamashita h.y.acetaminophen @ gmail.com
2019年 1月 15日 (火) 12:41:00 JST


Hi Enrico,

The following source causes an error
on pLaTeX and upLaTeX.

> ! Bad character code (42146).
> \char_value_catcode:n ...val:w #1\__int_eval_end:
>
> l.19 \xpatchcmd*{\hoge}{ほげ}{ふが}{}{}
>                                        ^^M
> A character number must be between 0 and 255.
> I changed this one to zero.


% ======
\documentclass{article}
\usepackage{regexpatch}
\def\hoge{ああ,ほげとほげがぴよ。}
\begin{document}
Before: \hoge

\xpatchcmd*{\hoge}{ほげ}{ふが}{}{}

After: \hoge
\end{document}
% ======

(e-)(u)pTeX does not allow character code > 255
for \catcode, \sfcode, etc.

For the time being, we can avoid the error by
adding empty braces at the beggining like

\def\hoge{{}ああ,ほげとほげがぴよ。}

but I hope the issue can be resolved on the package.

Best,
Hironobu

---
Hironobu YAMASHITA (GitHub: @aminophen)


issue メーリングリストの案内