codec レジストリとサポート関数
******************************

int PyCodec_Register(PyObject *search_function)
    * Part of the Stable ABI.*

   新しい codec 検索関数を登録します。

   As side effect, this tries to load the "encodings" package, if not
   yet done, to make sure that it is always first in the list of
   search functions.

int PyCodec_Unregister(PyObject *search_function)
    * Part of the Stable ABI since version 3.10.*

   Unregister a codec search function and clear the registry's cache.
   If the search function is not registered, do nothing. Return 0 on
   success. Raise an exception and return -1 on error.

   Added in version 3.10.

int PyCodec_KnownEncoding(const char *encoding)
    * Part of the Stable ABI.*

   *encoding* のための登録された codec が存在するかどうかに応じて "1"
   か "0" を返します。 この関数は常に成功します。

PyObject *PyCodec_Encode(PyObject *object, const char *encoding, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   汎用の codec ベースの encode API.

   *encoding* に応じて見つかったエンコーダ関数に対して *object* を渡し
   ます。 エラーハンドリングメソッドは *errors* で指定します。
   *errors* は "NULL" でもよく、その場合はその codec のデフォルトのメ
   ソッドが利用されます。 エンコーダが見つからなかった場合は
   "LookupError" を発生させます。

PyObject *PyCodec_Decode(PyObject *object, const char *encoding, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   汎用の codec ベースのデコード API.

   *encoding* に応じて見つかったデコーダ関数に対して *object* を渡しま
   す。 エラーハンドリングメソッドは *errors* で指定します。 *errors*
   は "NULL" でもよく、その場合はその codec のデフォルトのメソッドが利
   用されます。 デコーダが見つからなかった場合は "LookupError" を発生
   させます。


コーデック検索API
=================

次の関数では、文字列 *encoding* は全て小文字に変換することで、効率的に
、大文字小文字を無視した検索をします。 コーデックが見つからない場合、
"KeyError" を設定して "NULL" を返します。

PyObject *PyCodec_Encoder(const char *encoding)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* のエンコーダ関数を返します。

PyObject *PyCodec_Decoder(const char *encoding)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* のデコーダ関数を返します。

PyObject *PyCodec_IncrementalEncoder(const char *encoding, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* の "IncrementalEncoder" オブジェクトを返しま
   す。

PyObject *PyCodec_IncrementalDecoder(const char *encoding, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* の "IncrementalDecoder" オブジェクトを返しま
   す。

PyObject *PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* の "StreamReader" ファクトリ関数を返します。

PyObject *PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors)
    *Return value: New reference.** Part of the Stable ABI.*

   与えられた *encoding* の "StreamWriter" ファクトリ関数を返します。


Unicode エラーハンドラ用レジストリ API
======================================

int PyCodec_RegisterError(const char *name, PyObject *error)
    * Part of the Stable ABI.*

   エラーハンドルのためのコールバック関数 *error* を *name* で登録しま
   す。このコールバック関数は、コーデックがエンコードできない文字/デコ
   ードできないバイトに遭遇した時に、そのエンコード/デコード関数の呼び
   出しで *name* が指定されていたら呼び出されます。

   コールバックは1つの引数として、 "UnicodeEncodeError",
   "UnicodeDecodeError", "UnicodeTranslateError" のどれかのインスタン
   スを受け取ります。このインスタンスは問題のある文字列やバイト列に関
   する情報と、その元の文字列中のオフセットを持っています。(その情報を
   取得するための関数については Unicode 例外オブジェクト を参照してく
   ださい。) コールバックは渡された例外を発生させるか、2要素のタプルに
   問題のシーケンスの代替と、 encode/decode を再開する元の文字列中のオ
   フセットとなる整数を格納して返します。

   成功したら "0" を、エラー時は "-1" を返します。

PyObject *PyCodec_LookupError(const char *name)
    *Return value: New reference.** Part of the Stable ABI.*

   *name* で登録されたエラーハンドリングコールバック関数を検索します。
   特別な場合として、"NULL" が渡された場合、"strict" のエラーハンドリ
   ングコールバック関数を返します。

PyObject *PyCodec_StrictErrors(PyObject *exc)
    *Return value: Always NULL.** Part of the Stable ABI.*

   *exc* を例外として発生させます。

PyObject *PyCodec_IgnoreErrors(PyObject *exc)
    *Return value: New reference.** Part of the Stable ABI.*

   unicode エラーを無視し、問題の入力をスキップします。

PyObject *PyCodec_ReplaceErrors(PyObject *exc)
    *Return value: New reference.** Part of the Stable ABI.*

   unicode エラーを "?" か "U+FFFD" で置き換えます。

PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
    *Return value: New reference.** Part of the Stable ABI.*

   unicode encode エラーを XML文字参照で置き換えます。

PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
    *Return value: New reference.** Part of the Stable ABI.*

   unicode encode エラーをバックスラッシュエスケープ ("\x", "\u",
   "\U") で置き換えます。

PyObject *PyCodec_NameReplaceErrors(PyObject *exc)
    *Return value: New reference.** Part of the Stable ABI since
   version 3.7.*

   unicode encode エラーを "\N{...}" で置き換えます。

   Added in version 3.5.
