utf8 inputenc vs. babel

As Psyconaut points out an updated version of magyar.ldf is now available on CTAN fixing the problem.

There is some mistake in the tests for input encodings in magyar.ldf. You get the same error message if you choose latin2 as the encoding. The relevant part of magyar.ldf is:

\def\magyar@sugg@ie@lowb#1{\@latex@warning@no@line{Please use \string\usepackage[latin2]{inputenc} with\MessageBreak \string\usepackage[#1]{babel}}}%
  %** @param #1 \@inpenc@undefined@
  %** @param #2 input encoding name
  \def\magyar@sugg@ie@low#1#2#3\vfuzz#4{%
    \def\reserved@b{#2}%
    \def\reserved@a{latin2}%
    \ifx\reserved@a\reserved@b\else
      \def\reserved@a{utf8}%
      \ifx\reserved@a\reserved@b\else
        \def\reserved@a{utf8x}%
        \ifx\reserved@a\reserved@b\else
          \def\reserved@a{cp1250}%
          \ifx\reserved@a\reserved@b\else
            \magyar@sugg@ie@lowb{#4}%
          \fi
        \fi
      \fi
    \fi
  }

It is clear that what is intended is that latin2, utf8, utf8x or cp1250 encodings should not give an error. It looks like this file needs some updating.

Update: more analysis shows that what this command is expecting to receive is

 \@inpenc@undefined@ {latin2}....\vfuzz{#1}

with latin2 replaced by whatever encoding has actually been selected, but what it actually receives is

 \protect \@inpenc@undefined@ {latin2}....\vfuzz{#1}

Thus a simple work around is to change the first line of the definition to

 \def\magyar@sugg@ie@low\protect #1#2#3\vfuzz#4{%

so the pattern matching gobbles the \protect. At this stage, I suggest you copy magyar.ldf to your working directory or local texmf tree and make this change in that copy.

Update pts points out that the above does not work in old versions of babel. I can't test that, but his suggestion to change the definition to

\def\magyar@sugg@ie@low#1\@inpenc@undefined@#2#3\vfuzz#4{%

which apparently works in all versions. This has now been included in the version of magyar.ldf on CTAN, so the recommended action now is to update to that version.