# Buggy code
def init(locale_dirs, language, catalog="sphinx"):
    """Look for message catalogs in `locale_dirs` and *ensure* that there is at
    least a NullTranslations catalog set in `translators`.  If called multiple
    times or if several ``.mo`` files are found, their contents are merged
    together (thus making ``init`` reentrable).
    """
    global translators
    translator = translators.get(catalog)
    # ignore previously failed attempts to find message catalogs
    if isinstance(translator, gettext.NullTranslations):
        translator = None
    # the None entry is the system's default locale path
    has_translation = True

    # compile mo files if po file is updated
    # TODO: remove circular importing
    from sphinx.util.i18n import find_catalog_source_files

    for catinfo in find_catalog_source_files(locale_dirs, language, domains=[catalog]):
        catinfo.write_mo(language)

    # loading
    for dir_ in locale_dirs:
        try:
            trans = gettext.translation(catalog, localedir=dir_, languages=[language])
            if translator is None:
                translator = trans
            else:
                translator._catalog.update(trans._catalog)
        except Exception:
            # Language couldn't be found in the specified path
            pass
    # guarantee translators[catalog] exists
    if translator is None:
        translator = gettext.NullTranslations()
        has_translation = False
    translators[catalog] = translator
    if hasattr(translator, "ugettext"):
        translator.gettext = translator.ugettext
    return translator, has_translation


# Traceback (UnicodeDecodeError)
D:\test>set SPHINXOPTS=-T

D:\test>make.bat html
Running Sphinx v1.3.1
loading translations [ja]... done
loading pickled environment... not yet created
building [mo]: targets for 1 po files that are out of date
writing output... [100%] D:\test\locale\ja\LC_MESSAGES\index.mo
Traceback (most recent call last):
File "C:\Develop\pytools\sphinx-13\lib\site-packages\sphinx\cmdline.py", line 245, in main
app.build(opts.force_all, filenames)
File "C:\Develop\pytools\sphinx-13\lib\site-packages\sphinx\application.py", line 263, in build
self.builder.compile_update_catalogs()
File "C:\Develop\pytools\sphinx-13\lib\site-packages\sphinx\builders\__init__.py", line 199, in compile_update_catalogs
self.compile_catalogs(catalogs, message)
File "C:\Develop\pytools\sphinx-13\lib\site-packages\sphinx\builders\__init__.py", line 167, in compile_catalogs
catalog.write_mo(self.config.language)
File "C:\Develop\pytools\sphinx-13\lib\site-packages\sphinx\util\i18n.py", line 51, in write_mo
write_mo(mo, read_po(po, locale))
File "C:\Develop\pytools\sphinx-13\lib\site-packages\babel\messages\pofile.py", line 204, in read_po
for lineno, line in enumerate(fileobj.readlines()):
UnicodeDecodeError: 'cp932' codec can't decode byte 0x86 in position 576: illegal multibyte sequence

Encoding error:
'cp932' codec can't decode byte 0x86 in position 576: illegal multibyte sequence
The full traceback has been saved in D:\Temp\sphinx-err-8vfmzqmf.log, if you want to report the issue to the developers.

# Fixed code
def init(locale_dirs, language, catalog="sphinx", charset="utf-8"):
    """Look for message catalogs in `locale_dirs` and *ensure* that there is at
    least a NullTranslations catalog set in `translators`.  If called multiple
    times or if several ``.mo`` files are found, their contents are merged
    together (thus making ``init`` reentrable).
    """
    global translators
    translator = translators.get(catalog)
    # ignore previously failed attempts to find message catalogs
    if isinstance(translator, gettext.NullTranslations):
        translator = None
    # the None entry is the system's default locale path
    has_translation = True

    # compile mo files if po file is updated
    # TODO: remove circular importing
    from sphinx.util.i18n import find_catalog_source_files

    for catinfo in find_catalog_source_files(
        locale_dirs, language, domains=[catalog], charset=charset
    ):
        catinfo.write_mo(language)

    # loading
    for dir_ in locale_dirs:
        try:
            trans = gettext.translation(catalog, localedir=dir_, languages=[language])
            if translator is None:
                translator = trans
            else:
                translator._catalog.update(trans._catalog)
        except Exception:
            # Language couldn't be found in the specified path
            pass
    # guarantee translators[catalog] exists
    if translator is None:
        translator = gettext.NullTranslations()
        has_translation = False
    translators[catalog] = translator
    if hasattr(translator, "ugettext"):
        translator.gettext = translator.ugettext
    return translator, has_translation