Undefined control sequence Error with moderncv+Hebrew

I would like to use `modernv` to create a right-to-left CV document in Hebrew. I have downloaded and installed `culmus-latex`, and Hebrew+English LaTex documents compile without a problem.

I took `template.tex`, the moderncv boilerplate file, and added the Hebrew packages:

``````\usepackage[T1]{fontenc}
\usepackage[latin9,cp1255]{inputenc}

\usepackage{babel}
\usepackage{culmus}
``````

And changed the `documentclass` from:

``````\documentclass[11pt,a4paper,sans]{moderncv}
``````

To:

``````\documentclass[11pt,a4paper,sans,english,hebrew]{moderncv}
``````

I got the following error:

``````...
(/usr/share/texmf-texlive/tex/generic/babel/babel.def))
(/usr/share/texmf-texlive/tex/generic/babel/rlbabel.def
! Undefined control sequence.
<argument> \thesection

l.174 }

?
! Emergency stop.
<argument> \thesection

l.174 }

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on template.log.
``````

When the `inputenc` end `babel` lines are commented out:

``````%\usepackage[latin9,cp1255]{inputenc}
%\usepackage{babel}
``````

The document compiles, with erroneous Hebrew encoding:

To conclude,

Uh, so, uh, anything you can do to, uh, to help, would be... very... helpful...

-
Have you tried using `unicode` (utf8) encoding? `moderncv` does some hyperref setup in unicode by default, which might conflict with your encoding (just a wild guess)... – Xavier May 30 '13 at 5:24
@Xavier Yes, it's unicode UTF8. – Adam Matan May 30 '13 at 9:09
If your file is encoded in `utf8`, you need to use `\usepackage[utf8]{inputenc}` and remove the `\inputencoding{latin9}` and `\inputencoding{cp1255}` from your code. – Xavier May 30 '13 at 16:00
@Xavier thanks - could you post it as an answer so I can accept it? – Adam Matan Jun 1 '13 at 19:13

`moderncv` works best with `unicode` encoding for "exotic" characters, due to some internal `hyperref` setup.
Therefore, you should encode your file in `utf8` and use
``````\usepackage[utf8]{inputenc}
if you are compiling with pdfLaTeX (or nothing if you are compiling with Xe- or LuaLaTeX) and remove the `\inputencoding{latin9}` and `\inputencoding{cp1255}` from your code.