# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-17 16:44+0000\n" "PO-Revision-Date: 2025-09-16 00:00+0000\n" "Last-Translator: python-doc bot, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ja\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/unicode.rst:6 msgid "Unicode Objects and Codecs" msgstr "Unicode オブジェクトと codec" #: ../../c-api/unicode.rst:9 msgid "Unicode Objects" msgstr "Unicode オブジェクト" #: ../../c-api/unicode.rst:11 msgid "" "Since the implementation of :pep:`393` in Python 3.3, Unicode objects " "internally use a variety of representations, in order to allow handling the " "complete range of Unicode characters while staying memory efficient. There " "are special cases for strings where all code points are below 128, 256, or " "65536; otherwise, code points must be below 1114112 (which is the full " "Unicode range)." msgstr "" "Python3.3 の :pep:`393` 実装から、メモリ効率を維持しながらUnicode文字の完全な" "範囲を扱えるように、Unicodeオブジェクトは内部的に多様な表現形式を用いていま" "す。すべてのコードポイントが128、256または65536以下の文字列に対して特別なケー" "スが存在しますが、それ以外ではコードポイントは1114112以下 (これはすべての" "Unicode範囲です) でなければなりません。" #: ../../c-api/unicode.rst:17 msgid "" "UTF-8 representation is created on demand and cached in the Unicode object." msgstr "" #: ../../c-api/unicode.rst:21 msgid "" "The internal buffer always includes an extra trailing null character for " "compatibility with null terminated C strings. This extra character is not " "counted in :c:func:`PyUnicode_GetLength` nor in the various *size* arguments " "of the functions below." msgstr "" #: ../../c-api/unicode.rst:27 msgid "" "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " "with deprecated APIs. See :pep:`623` for more information." msgstr "" #: ../../c-api/unicode.rst:33 msgid "Unicode Type" msgstr "Unicode 型" #: ../../c-api/unicode.rst:35 msgid "" "These are the basic Unicode object types used for the Unicode implementation " "in Python:" msgstr "" "以下は Python の Unicode 実装に用いられている基本 Unicode オブジェクト型です:" #: ../../c-api/unicode.rst:40 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as :py:class:`str`." msgstr "" #: ../../c-api/unicode.rst:46 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode " "iterator type. It is used to iterate over Unicode string objects." msgstr "" #: ../../c-api/unicode.rst:54 msgid "" "These types are typedefs for unsigned integer types wide enough to contain " "characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " "single Unicode characters, use :c:type:`Py_UCS4`." msgstr "" "これらの型は、それぞれ、32ビット、16ビット、そして8ビットの文字を保持するのに" "充分な幅を持つ符号なしの整数型のtypedefです。単一のUnicode文字を扱う場合" "は、 :c:type:`Py_UCS4` を用いてください。" #: ../../c-api/unicode.rst:65 msgid "" "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " "almost all cases, they shouldn't be used directly, since all API functions " "that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" "これらの :c:type:`PyObject` のサブタイプは Python Unicode オブジェクトを表現" "します。\n" "Unicode オブジェクトを扱う全ての API 関数は :c:type:`PyObject` へのポインタを" "受け取って PyObject へのポインタを返すので、ほとんどの場合、これらの型を直接" "使うべきではありません。" #: ../../c-api/unicode.rst:72 msgid "" "The structure of a particular object can be determined using the following " "macros. The macros cannot fail; their behavior is undefined if their " "argument is not a Python Unicode object." msgstr "" #: ../../c-api/unicode.rst:81 msgid "True if *o* uses the :c:struct:`PyCompactUnicodeObject` structure." msgstr "" #: ../../c-api/unicode.rst:88 msgid "True if *o* uses the :c:struct:`PyASCIIObject` structure." msgstr "" #: ../../c-api/unicode.rst:93 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" #: ../../c-api/unicode.rst:98 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" "オブジェクト *obj* が Unicode オブジェクトか Unicode 型のサブタイプのインスタ" "ンスである場合に真を返します。この関数は常に成功します。" #: ../../c-api/unicode.rst:104 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" "オブジェクト *obj* が Unicode オブジェクトだがサブタイプのインスタンスでない" "場合に真を返します。この関数は常に成功します。" #: ../../c-api/unicode.rst:110 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" "Unicode 文字列のコードポイントでの長さを返します。\n" "*unicode* は \"正統な\" 表現形式の Unicode オブジェクトでなければなりません " "(ただしチェックはしません)。" #: ../../c-api/unicode.rst:120 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " "canonical representation has the correct character size; use :c:func:" "`PyUnicode_KIND` to select the right function." msgstr "" "文字に直接アクセスするために、 UCS1, UCS2, UCS4 のいずれかの整数型にキャスト" "された正統な表現形式へのポインタを返します。\n" "正統な表現が適正な文字サイズになっているかどうかのチェックはしません;\n" ":c:func:`PyUnicode_KIND` を使って正しい関数を選んでください。" #: ../../c-api/unicode.rst:132 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr ":c:func:`PyUnicode_KIND` マクロの返り値です。" #: ../../c-api/unicode.rst:136 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` は削除されました。" #: ../../c-api/unicode.rst:142 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " "*unicode* has to be a Unicode object in the \"canonical\" representation " "(not checked)." msgstr "" "この Unicode がデータを保存するのに1文字あたり何バイト使っているかを示す " "PyUnicode 種別の定数 (上を読んでください) のうち1つを返します。\n" "*unicode* は \"正統な\" 表現形式の Unicode オブジェクトでなければなりません " "(ただしチェックはしません)。" #: ../../c-api/unicode.rst:151 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" "生の Unicode バッファへの void ポインタを返します。\n" "*unicode* は \"正統な\" 表現形式の Unicode オブジェクトでなければなりません " "(ただしチェックはしません)。" #: ../../c-api/unicode.rst:160 msgid "" "Write the code point *value* to the given zero-based *index* in a string." msgstr "" #: ../../c-api/unicode.rst:162 msgid "" "The *kind* value and *data* pointer must have been obtained from a string " "using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. " "You must hold a reference to that string while calling :c:func:`!" "PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also " "apply." msgstr "" #: ../../c-api/unicode.rst:168 msgid "" "The function performs no checks for any of its requirements, and is intended " "for usage in loops." msgstr "" #: ../../c-api/unicode.rst:176 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks are performed." msgstr "" #: ../../c-api/unicode.rst:181 ../../c-api/unicode.rst:195 msgid "" "Accept reading the trailing null character at index :c:func:" "`PyUnicode_GetLength`." msgstr "" #: ../../c-api/unicode.rst:189 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " "\"canonical\" representation. This is less efficient than :c:func:" "`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" "Unicode オブジェクト *unicode* から文字を読み取ります。\n" "この Unicode オブジェクトは \"正統な\" 表現形式でなければなりません。\n" "何度も連続して読み取る場合には、このマクロは :c:func:`PyUnicode_READ` よりも" "非効率的です。" #: ../../c-api/unicode.rst:203 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" "*unicode* に基づいて他の文字列を作るのに適した最大のコードポイントを返しま" "す。\n" "この Unicode オブジェクトは \"正統な\" 表現形式でなければなりません。\n" "この値は常に概算値ですが、文字列全体を調べるよりも効率的です。" #: ../../c-api/unicode.rst:212 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" "文字列が、 :ref:`identifiers` 節の言語定義における有効な識別子であれば ``1`` " "を返します。それ以外の場合は ``0`` を返します。" #: ../../c-api/unicode.rst:215 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" #: ../../c-api/unicode.rst:222 msgid "" "Return true if the string only contains ASCII characters. Equivalent to :py:" "meth:`str.isascii`." msgstr "" #: ../../c-api/unicode.rst:230 msgid "" "If the hash of *str*, as returned by :c:func:`PyObject_Hash`, has been " "cached and is immediately available, return it. Otherwise, return ``-1`` " "*without* setting an exception." msgstr "" #: ../../c-api/unicode.rst:234 msgid "" "If *str* is not a string (that is, if ``PyUnicode_Check(obj)`` is false), " "the behavior is undefined." msgstr "" #: ../../c-api/unicode.rst:237 msgid "This function never fails with an exception." msgstr "" #: ../../c-api/unicode.rst:239 msgid "" "Note that there are no guarantees on when an object's hash is cached, and " "the (non-)existence of a cached hash does not imply that the string has any " "other properties." msgstr "" #: ../../c-api/unicode.rst:245 msgid "Unicode Character Properties" msgstr "Unicode 文字プロパティ" #: ../../c-api/unicode.rst:247 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" "Unicode は数多くの異なる文字プロパティ (character property) を提供していま" "す。よく使われる文字プロパティは、以下のマクロで利用できます。これらのマクロ" "は Python の設定に応じて、各々 C の関数に対応付けられています。" #: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "*ch* が空白文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:259 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "*ch* が小文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:264 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "*ch* が大文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:269 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" "*ch* がタイトルケース文字 (titlecase character) かどうかに応じて ``1`` また" "は ``0`` を返します。" #: ../../c-api/unicode.rst:274 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "*ch* が改行文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:279 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "*ch* が decimal 文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:284 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "*ch* が digit 文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:289 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" "*ch* が数字 (numeric) 文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:294 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" "*ch* がアルファベット文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:299 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "*ch* が英数文字かどうかに応じて ``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:304 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " "the sense of :meth:`str.isprintable`." msgstr "" #: ../../c-api/unicode.rst:308 msgid "These APIs can be used for fast direct character conversions:" msgstr "以下の API は、高速に直接文字変換を行うために使われます:" #: ../../c-api/unicode.rst:313 msgid "Return the character *ch* converted to lower case." msgstr "*ch* を小文字に変換したものを返します。" #: ../../c-api/unicode.rst:318 msgid "Return the character *ch* converted to upper case." msgstr "*ch* を大文字に変換したものを返します。" #: ../../c-api/unicode.rst:323 msgid "Return the character *ch* converted to title case." msgstr "*ch* をタイトルケース文字に変換したものを返します。" #: ../../c-api/unicode.rst:328 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" #: ../../c-api/unicode.rst:334 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" #: ../../c-api/unicode.rst:340 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" "*ch* を double に変換したものを返します。不可能ならば ``-1.0`` を返します。こ" "の関数は例外を送出しません。" #: ../../c-api/unicode.rst:344 msgid "These APIs can be used to work with surrogates:" msgstr "これらの API はサロゲートにも使えます:" #: ../../c-api/unicode.rst:348 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" "*ch* がサロゲートかどうか (``0xD800 <= ch <= 0xDFFF``) をチェックします。" #: ../../c-api/unicode.rst:352 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" "*ch* が上位サロゲートかどうか (``0xD800 <= ch <= 0xDBFF``) をチェックします。" #: ../../c-api/unicode.rst:356 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" "*ch* が下位サロゲートかどうか (``0xDC00 <= ch <= 0xDFFF``) をチェックします。" #: ../../c-api/unicode.rst:360 msgid "" "Return the high UTF-16 surrogate (``0xD800`` to ``0xDBFF``) for a Unicode " "code point in the range ``[0x10000; 0x10FFFF]``." msgstr "" #: ../../c-api/unicode.rst:365 msgid "" "Return the low UTF-16 surrogate (``0xDC00`` to ``0xDFFF``) for a Unicode " "code point in the range ``[0x10000; 0x10FFFF]``." msgstr "" #: ../../c-api/unicode.rst:370 msgid "" "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " "surrogate pair. *high* must be in the range ``[0xD800; 0xDBFF]`` and *low* " "must be in the range ``[0xDC00; 0xDFFF]``." msgstr "" #: ../../c-api/unicode.rst:377 msgid "Creating and accessing Unicode strings" msgstr "Unicode 文字列の生成とアクセス" #: ../../c-api/unicode.rst:379 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" "Unicode オブジェクトを生成したり、Unicode のシーケンスとしての基本的なプロパ" "ティにアクセスしたりするには、以下の API を使ってください:" #: ../../c-api/unicode.rst:384 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" "新しい Unicode オブジェクトを生成します。\n" "*maxchar* は文字列に並べるコードポイントの正しい最大値にすべきです。\n" "その値は概算値として 127, 255, 65535, 1114111 の一番近い値に切り上げられま" "す。" #: ../../c-api/unicode.rst:388 msgid "On error, set an exception and return ``NULL``." msgstr "" #: ../../c-api/unicode.rst:390 msgid "" "After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :" "c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:" "`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, " "take care to not “use” the result while it is being modified. In particular, " "before it's filled with its final contents, a string:" msgstr "" #: ../../c-api/unicode.rst:397 msgid "must not be hashed," msgstr "" #: ../../c-api/unicode.rst:398 msgid "" "must not be :c:func:`converted to UTF-8 `, or " "another non-\"canonical\" representation," msgstr "" #: ../../c-api/unicode.rst:400 msgid "must not have its reference count changed," msgstr "" #: ../../c-api/unicode.rst:401 msgid "must not be shared with code that might do one of the above." msgstr "" #: ../../c-api/unicode.rst:403 msgid "" "This list is not exhaustive. Avoiding these uses is your responsibility; " "Python does not always check these requirements." msgstr "" #: ../../c-api/unicode.rst:406 msgid "" "To avoid accidentally exposing a partially-written string object, prefer " "using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` " "functions below." msgstr "" #: ../../c-api/unicode.rst:417 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" "`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " "1, 2 or 4 bytes per character, as given by the kind." msgstr "" "与えられた *kind* (取り得る値は :c:macro:`PyUnicode_1BYTE_KIND` などの :c:" "func:`PyUnicode_KIND` が返す値です) の Unicode オブジェクトを生成します。\n" "*buffer* は、与えられた kind に従って1文字あたり 1, 2, 4 バイトのいずれかを単" "位として、長さ *size* の配列へのポインタでなければなりません。" #: ../../c-api/unicode.rst:422 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" "macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" #: ../../c-api/unicode.rst:428 msgid "" "All characters must be in range [U+0000; U+10ffff]. If *kind* is :c:macro:" "`PyUnicode_4BYTE_KIND` and the string contains invalid characters, the " "behavior is undefined." msgstr "" #: ../../c-api/unicode.rst:437 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " "object. The return value might be a shared object, i.e. modification of the " "data is not allowed." msgstr "" #: ../../c-api/unicode.rst:443 msgid "This function raises :exc:`SystemError` when:" msgstr "" #: ../../c-api/unicode.rst:445 msgid "*size* < 0," msgstr "" #: ../../c-api/unicode.rst:446 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" #: ../../c-api/unicode.rst:448 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" #: ../../c-api/unicode.rst:454 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" "UTF-8 エンコードされたnull終端のchar 型バッファ *str* から Unicode オブジェク" "トを生成します。" #: ../../c-api/unicode.rst:460 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " "return a string with the values formatted into it. The variable arguments " "must be C types and must correspond exactly to the format characters in the " "*format* ASCII-encoded string." msgstr "" #: ../../c-api/unicode.rst:466 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" "一つの変換指定子は 2 またはそれ以上の文字を含み、その構成要素は以下からなりま" "すが、示した順に出現しなければなりません:" #: ../../c-api/unicode.rst:469 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "指定子の開始を示す文字 ``'%'`` 。" #: ../../c-api/unicode.rst:471 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "変換フラグ (オプション)。一部の変換型の結果に影響します。" #: ../../c-api/unicode.rst:474 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" "`int`, and the object to convert comes after the minimum field width and " "optional precision." msgstr "" #: ../../c-api/unicode.rst:479 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " "next argument, which must be of type :c:expr:`int`, and the value to convert " "comes after the precision." msgstr "" #: ../../c-api/unicode.rst:484 msgid "Length modifier (optional)." msgstr "精度長変換子 (オプション)。" #: ../../c-api/unicode.rst:486 msgid "Conversion type." msgstr "変換型。" #: ../../c-api/unicode.rst:488 msgid "The conversion flag characters are:" msgstr "変換フラグ文字を以下に示します:" #: ../../c-api/unicode.rst:493 msgid "Flag" msgstr "Flag" #: ../../c-api/unicode.rst:493 msgid "Meaning" msgstr "意味" #: ../../c-api/unicode.rst:495 msgid "``0``" msgstr "``0``" #: ../../c-api/unicode.rst:495 msgid "The conversion will be zero padded for numeric values." msgstr "数値型に対してゼロによるパディングを行います。" #: ../../c-api/unicode.rst:497 msgid "``-``" msgstr "" #: ../../c-api/unicode.rst:497 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" #: ../../c-api/unicode.rst:501 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" #: ../../c-api/unicode.rst:508 msgid "Modifier" msgstr "修飾子" #: ../../c-api/unicode.rst:508 msgid "Types" msgstr "型" #: ../../c-api/unicode.rst:510 msgid "``l``" msgstr "``l``" #: ../../c-api/unicode.rst:510 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` または :c:expr:`unsigned long`" #: ../../c-api/unicode.rst:512 msgid "``ll``" msgstr "``ll``" #: ../../c-api/unicode.rst:512 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` または :c:expr:`unsigned long long`" #: ../../c-api/unicode.rst:514 msgid "``j``" msgstr "" #: ../../c-api/unicode.rst:514 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr "" #: ../../c-api/unicode.rst:516 msgid "``z``" msgstr "" #: ../../c-api/unicode.rst:516 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr "" #: ../../c-api/unicode.rst:518 msgid "``t``" msgstr "``t``" #: ../../c-api/unicode.rst:518 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" #: ../../c-api/unicode.rst:521 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" #: ../../c-api/unicode.rst:524 msgid "The conversion specifiers are:" msgstr "" #: ../../c-api/unicode.rst:530 msgid "Conversion Specifier" msgstr "" #: ../../c-api/unicode.rst:531 msgid "Type" msgstr "型" #: ../../c-api/unicode.rst:532 msgid "Comment" msgstr "備考" #: ../../c-api/unicode.rst:534 msgid "``%``" msgstr "``%``" #: ../../c-api/unicode.rst:535 msgid "*n/a*" msgstr "*n/a*" #: ../../c-api/unicode.rst:536 msgid "The literal ``%`` character." msgstr "" #: ../../c-api/unicode.rst:538 msgid "``d``, ``i``" msgstr "" #: ../../c-api/unicode.rst:539 ../../c-api/unicode.rst:543 #: ../../c-api/unicode.rst:547 ../../c-api/unicode.rst:551 #: ../../c-api/unicode.rst:555 msgid "Specified by the length modifier" msgstr "" #: ../../c-api/unicode.rst:540 msgid "The decimal representation of a signed C integer." msgstr "" #: ../../c-api/unicode.rst:542 msgid "``u``" msgstr "``u``" #: ../../c-api/unicode.rst:544 msgid "The decimal representation of an unsigned C integer." msgstr "" #: ../../c-api/unicode.rst:546 msgid "``o``" msgstr "``o``" #: ../../c-api/unicode.rst:548 msgid "The octal representation of an unsigned C integer." msgstr "" #: ../../c-api/unicode.rst:550 msgid "``x``" msgstr "``x``" #: ../../c-api/unicode.rst:552 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" #: ../../c-api/unicode.rst:554 msgid "``X``" msgstr "``X``" #: ../../c-api/unicode.rst:556 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" #: ../../c-api/unicode.rst:558 msgid "``c``" msgstr "``c``" #: ../../c-api/unicode.rst:559 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" #: ../../c-api/unicode.rst:560 msgid "A single character." msgstr "" #: ../../c-api/unicode.rst:562 msgid "``s``" msgstr "``s``" #: ../../c-api/unicode.rst:563 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` または :c:expr:`const wchar_t*`" #: ../../c-api/unicode.rst:564 msgid "A null-terminated C character array." msgstr "null で終端された C の文字列。" #: ../../c-api/unicode.rst:566 msgid "``p``" msgstr "``p``" #: ../../c-api/unicode.rst:567 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" #: ../../c-api/unicode.rst:568 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" "C ポインタの 16 進表記。``printf(\"%p\")`` とほとんど同じですが、プラット" "フォームにおける ``printf`` の定義に関わりなく先頭にリテラル ``0x`` が付きま" "す。" #: ../../c-api/unicode.rst:573 msgid "``A``" msgstr "``A``" #: ../../c-api/unicode.rst:574 ../../c-api/unicode.rst:578 #: ../../c-api/unicode.rst:588 ../../c-api/unicode.rst:592 #: ../../c-api/unicode.rst:596 ../../c-api/unicode.rst:601 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" #: ../../c-api/unicode.rst:575 msgid "The result of calling :func:`ascii`." msgstr ":func:`ascii` の戻り値。" #: ../../c-api/unicode.rst:577 msgid "``U``" msgstr "``U``" #: ../../c-api/unicode.rst:579 msgid "A Unicode object." msgstr "Unicode オブジェクト。" #: ../../c-api/unicode.rst:581 msgid "``V``" msgstr "``V``" #: ../../c-api/unicode.rst:582 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" #: ../../c-api/unicode.rst:583 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" #: ../../c-api/unicode.rst:587 msgid "``S``" msgstr "" #: ../../c-api/unicode.rst:589 msgid "The result of calling :c:func:`PyObject_Str`." msgstr ":c:func:`PyObject_Str` の戻り値。" #: ../../c-api/unicode.rst:591 msgid "``R``" msgstr "" #: ../../c-api/unicode.rst:593 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr ":c:func:`PyObject_Repr` の戻り値。" #: ../../c-api/unicode.rst:595 msgid "``T``" msgstr "" #: ../../c-api/unicode.rst:597 msgid "" "Get the fully qualified name of an object type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:600 msgid "``#T``" msgstr "" #: ../../c-api/unicode.rst:602 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" #: ../../c-api/unicode.rst:605 msgid "``N``" msgstr "``N``" #: ../../c-api/unicode.rst:606 ../../c-api/unicode.rst:611 msgid ":c:expr:`PyTypeObject*`" msgstr "" #: ../../c-api/unicode.rst:607 msgid "" "Get the fully qualified name of a type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:610 msgid "``#N``" msgstr "" #: ../../c-api/unicode.rst:612 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" #: ../../c-api/unicode.rst:616 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " "the length modifier ``l`` is used) for ``\"%s\"`` and ``\"%V\"`` (if the " "``PyObject*`` argument is ``NULL``), and a number of characters for " "``\"%A\"``, ``\"%U\"``, ``\"%S\"``, ``\"%R\"`` and ``\"%V\"`` (if the " "``PyObject*`` argument is not ``NULL``)." msgstr "" #: ../../c-api/unicode.rst:624 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" #: ../../c-api/unicode.rst:628 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "``\"%lld\"``, ``\"%llu\"`` のサポートが追加されました。" #: ../../c-api/unicode.rst:631 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "``\"%li\"``, ``\"%lli\"``, ``\"%zi\"`` のサポートが追加されました。" #: ../../c-api/unicode.rst:634 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" "``\"%s\"``, ``\"%A\"``, ``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` での幅" "フォーマッタおよび精度フォーマッタのサポートが追加されました。" #: ../../c-api/unicode.rst:638 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " "conversions. Length modifier ``l`` is now applied to conversion specifiers " "``s`` and ``V``. Support for variable width and precision ``*``. Support for " "flag ``-``." msgstr "" #: ../../c-api/unicode.rst:646 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" #: ../../c-api/unicode.rst:650 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "" #: ../../c-api/unicode.rst:656 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" "ちょうど2つの引数を取ることを除いて、 :c:func:`PyUnicode_FromFormat` と同じ" "です。" #: ../../c-api/unicode.rst:662 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" #: ../../c-api/unicode.rst:666 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" "Unicode やそのサブタイプ以外のオブジェクトでは :exc:`TypeError` が引き起こさ" "れます。" #: ../../c-api/unicode.rst:671 msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" #: ../../c-api/unicode.rst:673 msgid "" "The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " "the case it is not." msgstr "" #: ../../c-api/unicode.rst:680 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "エンコードされている *obj* を Unicode オブジェクトにデコードします。" #: ../../c-api/unicode.rst:682 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " "the error handling defined by *errors*. Both can be ``NULL`` to have the " "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" ":class:`bytes` や :class:`bytearray` や他の :term:`bytes-like objects ` は、与えられた *encoding* に従ってデコードされ、 *errors* で定" "義されたエラーハンドリングが使われます。\n" "これらの引数は両方とも ``NULL`` にでき、その場合この API はデフォルト値を使い" "ます (詳しことは :ref:`builtincodecs` を参照してください)。" #: ../../c-api/unicode.rst:688 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" "その他のUnicodeオブジェクトを含むオブジェクトは :exc:`TypeError` 例外を引き起" "こします。" #: ../../c-api/unicode.rst:691 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" "この API は、エラーが生じたときには ``NULL`` を返します。呼び出し側は返された" "オブジェクトに対し参照カウンタを 1 つ減らす (decref) する責任があります。" #: ../../c-api/unicode.rst:697 msgid "" "Append the string *right* to the end of *p_left*. *p_left* must point to a :" "term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " "releases (\":term:`steals `\") this reference." msgstr "" #: ../../c-api/unicode.rst:702 msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." msgstr "" #: ../../c-api/unicode.rst:704 msgid "On success, set *\\*p_left* to a new strong reference to the result." msgstr "" #: ../../c-api/unicode.rst:709 msgid "" "The function is similar to :c:func:`PyUnicode_Append`, with the only " "difference being that it decrements the reference count of *right* by one." msgstr "" #: ../../c-api/unicode.rst:715 msgid "" "Return a mapping suitable for decoding a custom single-byte encoding. Given " "a Unicode string *string* of up to 256 characters representing an encoding " "table, returns either a compact internal mapping object or a dictionary " "mapping character ordinals to byte values. Raises a :exc:`TypeError` and " "return ``NULL`` on invalid input." msgstr "" #: ../../c-api/unicode.rst:726 msgid "" "Return the name of the default string encoding, ``\"utf-8\"``. See :func:" "`sys.getdefaultencoding`." msgstr "" #: ../../c-api/unicode.rst:729 msgid "" "The returned string does not need to be freed, and is valid until " "interpreter shutdown." msgstr "" #: ../../c-api/unicode.rst:735 msgid "Return the length of the Unicode object, in code points." msgstr "Unicode オブジェクトの長さをコードポイントで返します。" #: ../../c-api/unicode.rst:737 msgid "On error, set an exception and return ``-1``." msgstr "" #: ../../c-api/unicode.rst:741 msgid "The length does not count the trailing null character." msgstr "" #: ../../c-api/unicode.rst:752 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" "memcpy` if possible. Returns ``-1`` and sets an exception on error, " "otherwise returns the number of copied characters." msgstr "" "ある Unicode オブジェクトから他へ文字をコピーします。\n" "この関数は必要なときに文字変換を行い、可能な場合は :c:func:`!memcpy` へ差し戻" "します。\n" "失敗のときには ``-1`` を返し、例外を設定します。そうでない場合は、コピーした" "文字数を返します。" #: ../../c-api/unicode.rst:757 ../../c-api/unicode.rst:787 #: ../../c-api/unicode.rst:807 msgid "" "The string must not have been “used” yet. See :c:func:`PyUnicode_New` for " "details." msgstr "" #: ../../c-api/unicode.rst:765 msgid "" "Resize a Unicode object *\\*unicode* to the new *length* in code points." msgstr "" #: ../../c-api/unicode.rst:767 msgid "" "Try to resize the string in place (which is usually faster than allocating a " "new string and copying characters), or create a new string." msgstr "" #: ../../c-api/unicode.rst:770 msgid "" "*\\*unicode* is modified to point to the new (resized) object and ``0`` is " "returned on success. Otherwise, ``-1`` is returned and an exception is set, " "and *\\*unicode* is left untouched." msgstr "" #: ../../c-api/unicode.rst:774 msgid "" "The function doesn't check string content, the result may not be a string in " "canonical representation." msgstr "" #: ../../c-api/unicode.rst:781 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" "文字列を文字で埋めます: ``unicode[start:start+length]`` で *fill_char* を埋め" "ることになります。" #: ../../c-api/unicode.rst:784 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" "*fill_char* が文字列の最大文字よりも大きい場合や、文字列2つ以上の参照を持って" "た場合は失敗します。" #: ../../c-api/unicode.rst:790 msgid "" "Return the number of written characters, or return ``-1`` and raise an " "exception on error." msgstr "" #: ../../c-api/unicode.rst:799 msgid "" "Write a *character* to the string *unicode* at the zero-based *index*. " "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "" #: ../../c-api/unicode.rst:802 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object's reference count is one. See :c:func:" "`PyUnicode_WRITE` for a version that skips these checks, making them your " "responsibility." msgstr "" #: ../../c-api/unicode.rst:815 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" "文字列から文字を読み取ります。\n" "エラーチェックを行わない :c:func:`PyUnicode_READ_CHAR` とは対照的に、この関数" "は *unicode* が Unicode オブジェクトであること、インデックスが範囲内であるこ" "とをチェックします。" #: ../../c-api/unicode.rst:819 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "" #: ../../c-api/unicode.rst:823 msgid "" "Do not accept reading the trailing null character at index :c:func:" "`PyUnicode_GetLength`." msgstr "" #: ../../c-api/unicode.rst:832 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" #: ../../c-api/unicode.rst:842 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " "particular, a :exc:`SystemError` if *buflen* is smaller than the length of " "*unicode*). *buffer* is returned on success." msgstr "" #: ../../c-api/unicode.rst:852 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" "`MemoryError` set. The returned buffer always has an extra null code point " "appended." msgstr "" "文字列 *unicode* を :c:func:`PyMem_Malloc` でメモリ確保された新しい UCS4 型の" "バッファにコピーします。\n" "これが失敗した場合は、 ``NULL`` を返し :exc:`MemoryError` をセットします。\n" "返されたバッファは必ず null コードポイントが追加されています。" #: ../../c-api/unicode.rst:861 msgid "Locale Encoding" msgstr "ロケールエンコーディング" #: ../../c-api/unicode.rst:863 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" "現在のロケールエンコーディングはオペレーティングシステムのテキストをデコード" "するのに使えます。" #: ../../c-api/unicode.rst:870 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The decoder uses " "``\"strict\"`` error handler if *errors* is ``NULL``. *str* must end with a " "null character but cannot contain embedded null characters." msgstr "" #: ../../c-api/unicode.rst:877 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:880 ../../c-api/unicode.rst:915 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" #: ../../c-api/unicode.rst:884 ../../c-api/unicode.rst:1000 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 関数。" #: ../../c-api/unicode.rst:888 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" "`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " "locale encoding was used for ``strict``." msgstr "" "この関数は、 Android 以外では現在のロケールエンコーディングを " "``surrogateescape`` エラーハンドラで使うようになりました。\n" "以前は、 :c:func:`Py_DecodeLocale` が ``surrogateescape`` で使われ、現在のロ" "ケールエンコーディングは ``strict`` で使われていました。" #: ../../c-api/unicode.rst:897 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" #: ../../c-api/unicode.rst:905 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " "``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" #: ../../c-api/unicode.rst:912 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:919 ../../c-api/unicode.rst:1031 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 関数。" #: ../../c-api/unicode.rst:923 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" "`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " "locale encoding was used for ``strict``." msgstr "" "この関数は、 Android 以外では現在のロケールエンコーディングを " "``surrogateescape`` エラーハンドラで使うようになりました。\n" "以前は、 :c:func:`Py_EncodeLocale` が ``surrogateescape`` で使われ、現在のロ" "ケールエンコーディングは ``strict`` で使われていました。" #: ../../c-api/unicode.rst:932 msgid "File System Encoding" msgstr "ファイルシステムエンコーディング" #: ../../c-api/unicode.rst:934 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" #: ../../c-api/unicode.rst:937 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" #: ../../c-api/unicode.rst:943 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " "-- obtained directly or through the :class:`os.PathLike` interface -- to :" "class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " "` which must be released when it is no longer used and return " "a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" #: ../../c-api/unicode.rst:955 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" #: ../../c-api/unicode.rst:960 ../../c-api/unicode.rst:987 msgid "Accepts a :term:`path-like object`." msgstr ":term:`path-like object` を受け入れるようになりました。" #: ../../c-api/unicode.rst:963 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" #: ../../c-api/unicode.rst:969 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " "interface -- to :class:`str` using :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " "*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" "c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" "`strong reference` to a :ref:`Unicode object ` which must be " "released when it is no longer used and return a non-zero value (:c:macro:" "`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " "result. On failure, return ``0`` with an exception set." msgstr "" #: ../../c-api/unicode.rst:982 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" #: ../../c-api/unicode.rst:993 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:995 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" #: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1015 #: ../../c-api/unicode.rst:1035 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" #: ../../c-api/unicode.rst:1009 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" #: ../../c-api/unicode.rst:1012 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" #: ../../c-api/unicode.rst:1022 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" #: ../../c-api/unicode.rst:1026 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" #: ../../c-api/unicode.rst:1040 msgid "wchar_t Support" msgstr "wchar_t サポート" #: ../../c-api/unicode.rst:1042 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr ":c:type:`wchar_t` をサポートするプラットフォームでの wchar_t サポート:" #: ../../c-api/unicode.rst:1046 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " "itself compute the length, using :c:func:`!wcslen`. Return ``NULL`` on " "failure." msgstr "" #: ../../c-api/unicode.rst:1054 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " "trailing null termination character). Return the number of :c:type:" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" #: ../../c-api/unicode.rst:1059 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" #: ../../c-api/unicode.rst:1062 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" "expr:`wchar_t*` string is null-terminated in case this is required by the " "application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" #: ../../c-api/unicode.rst:1072 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " "when used with most C functions. If *size* is ``NULL`` and the :c:expr:" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" #: ../../c-api/unicode.rst:1080 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" #: ../../c-api/unicode.rst:1087 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" #: ../../c-api/unicode.rst:1095 msgid "Built-in Codecs" msgstr "組み込み codec (built-in codec)" #: ../../c-api/unicode.rst:1097 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" "Python には、処理速度を高めるために C で書かれた codec が揃えてあります。これ" "ら全ての codec は以下の関数を介して直接利用できます。" #: ../../c-api/unicode.rst:1100 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" "以下の API の多くが、 *encoding* と *errors* という二つの引数をとります。これ" "らのパラメータは、組み込みの文字列コンストラクタである :func:`str` における同" "名のパラメータと同じ意味を持ちます。" #: ../../c-api/unicode.rst:1104 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " "encoding file names. This uses the :term:`filesystem encoding and error " "handler` internally." msgstr "" #: ../../c-api/unicode.rst:1109 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" "*errors* で指定するエラー処理もまた、 ``NULL`` を指定できます。 ``NULL`` を指" "定すると、codec で定義されているデフォルト処理の使用を意味します。全ての組み" "込み codec で、デフォルトのエラー処理は \"strict\" (:exc:`ValueError` を送出" "する) になっています。" #: ../../c-api/unicode.rst:1113 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" "個々の codec は全て同様のインターフェースを使っています。個別の codec の説明" "では、説明を簡単にするために以下の汎用のインターフェースとの違いだけを説明し" "ています。" #: ../../c-api/unicode.rst:1118 msgid "Generic Codecs" msgstr "汎用 codec" #: ../../c-api/unicode.rst:1120 msgid "The following macro is provided:" msgstr "" #: ../../c-api/unicode.rst:1125 msgid "The Unicode code point ``U+FFFD`` (replacement character)." msgstr "" #: ../../c-api/unicode.rst:1127 msgid "" "This Unicode character is used as the replacement character during decoding " "if the *errors* argument is set to \"replace\"." msgstr "" #: ../../c-api/unicode.rst:1131 msgid "These are the generic codec APIs:" msgstr "以下は汎用 codec の API です:" #: ../../c-api/unicode.rst:1137 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " "the same name in the :func:`str` built-in function. The codec to be used is " "looked up using the Python codec registry. Return ``NULL`` if an exception " "was raised by the codec." msgstr "" #: ../../c-api/unicode.rst:1147 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " "name in the Unicode :meth:`~str.encode` method. The codec to be used is " "looked up using the Python codec registry. Return ``NULL`` if an exception " "was raised by the codec." msgstr "" "Unicode オブジェクトをエンコードし、その結果を Python の bytes オブジェクトと" "して返します。\n" "*encoding* および *errors* は Unicode 型の :meth:`~str.encode` メソッドに与え" "る同名のパラメータと同じ意味を持ちます。\n" "使用する codec の検索は、 Python の codec レジストリを使って行います。\n" "codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1155 msgid "UTF-8 Codecs" msgstr "UTF-8 Codecs" #: ../../c-api/unicode.rst:1157 msgid "These are the UTF-8 codec APIs:" msgstr "以下は UTF-8 codec の APIです:" #: ../../c-api/unicode.rst:1162 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" "UTF-8 でエンコードされた *size* バイトの文字列 *str* から Unicode オブジェク" "トを生成します。codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1169 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " "not be treated as an error. Those bytes will not be decoded and the number " "of bytes that have been decoded will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` の場合、 :c:func:`PyUnicode_DecodeUTF8` と同じように動" "作します。 *consumed* が ``NULL`` でない場合、末尾の不完全な UTF-8 バイト列は" "エラーとみなされません。これらのバイト列はデコードされず、デコードされたバイ" "ト数は *consumed* に格納されます。" #: ../../c-api/unicode.rst:1177 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" "UTF-8 で Unicode オブジェクトをエンコードし、結果を Python バイト列オブジェク" "トとして返します。エラー処理は \"strict\" です。 codec が例外を送出した場合に" "は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1181 ../../c-api/unicode.rst:1196 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" #: ../../c-api/unicode.rst:1187 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " "argument can be ``NULL``; in this case no size will be stored. The returned " "buffer always has an extra null byte appended (not included in *size*), " "regardless of whether there are any other null code points." msgstr "" "Unicode オブジェクトを UTF-8 でエンコードしたものへのポインタを返し、エンコー" "ドされた表現形式でのサイズ (バイト単位) を *size* に格納します。\n" "*size* 引数は ``NULL`` でも構いません; その場合はサイズは格納されません。\n" "返されるバッファには、 null コードポイントがあるかどうかに関わらず、常に " "null バイトが終端に付加されています (これは *size* には勘定されません)。" #: ../../c-api/unicode.rst:1193 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" #: ../../c-api/unicode.rst:1199 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " "is not responsible for deallocating the buffer. The buffer is deallocated " "and pointers to it become invalid when the Unicode object is garbage " "collected." msgstr "" #: ../../c-api/unicode.rst:1206 ../../c-api/unicode.rst:1228 msgid "The return type is now ``const char *`` rather than ``char *``." msgstr "" #: ../../c-api/unicode.rst:1209 msgid "This function is a part of the :ref:`limited API `." msgstr "" #: ../../c-api/unicode.rst:1215 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" ":c:func:`PyUnicode_AsUTF8AndSize` とほぼ同じですが、サイズを格納しません。" #: ../../c-api/unicode.rst:1219 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " "leading to truncation. If truncation is an issue, it is recommended to use :" "c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" #: ../../c-api/unicode.rst:1233 msgid "UTF-32 Codecs" msgstr "UTF-32 Codecs" #: ../../c-api/unicode.rst:1235 msgid "These are the UTF-32 codec APIs:" msgstr "以下は UTF-32 codec API です:" #: ../../c-api/unicode.rst:1241 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" "UTF-32 でエンコードされたバッファ文字列から *size* バイトをデコードし、 " "Unicodeオブジェクトとして返します。 *errors* は (``NULL`` でないなら) エラー" "ハンドラを指定します。デフォルトは \"strict\" です。" #: ../../c-api/unicode.rst:1245 ../../c-api/unicode.rst:1295 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" "*byteorder* が ``NULL`` でない時、デコーダは与えられたバイトオーダーでデコー" "ドを開始します。 ::" #: ../../c-api/unicode.rst:1248 ../../c-api/unicode.rst:1298 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" #: ../../c-api/unicode.rst:1252 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " "is not copied into the resulting Unicode string. If ``*byteorder`` is " "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" "``*byteorder`` が 0 で、入力データの最初の 4 バイトが byte order mark (BOM) " "ならば、デコーダはこのバイトオーダーに切り替え、BOM は結果の Unicode 文字列に" "コピーされません。 ``*byteorder`` が ``-1`` または ``1`` ならば、全ての byte " "order mark は出力にコピーされます。" #: ../../c-api/unicode.rst:1257 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" "デコードが完了した後、入力データの終端に来た時点でのバイトオーダーを " "*\\*byteorder* にセットします。" #: ../../c-api/unicode.rst:1260 ../../c-api/unicode.rst:1311 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" "*byteorder* が ``NULL`` のとき、 codec は native order モードで開始します。" #: ../../c-api/unicode.rst:1262 ../../c-api/unicode.rst:1313 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "codec が例外を発生させたときは ``NULL`` を返します。" #: ../../c-api/unicode.rst:1268 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " "treat trailing incomplete UTF-32 byte sequences (such as a number of bytes " "not divisible by four) as an error. Those bytes will not be decoded and the " "number of bytes that have been decoded will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` のとき、 :c:func:`PyUnicode_DecodeUTF32` と同じように" "振る舞います。 *consumed* が ``NULL`` でないとき、 :c:func:" "`PyUnicode_DecodeUTF32Stateful` は末尾の不完全な (4 で割り切れない長さのバイ" "ト列などの) UTF-32 バイト列をエラーとして扱いません。末尾の不完全なバイト列は" "デコードされず、デコードされたバイト数が *consumed* に格納されます。" #: ../../c-api/unicode.rst:1277 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" "ネイティブバイトオーダーで UTF-32 エンコーディングされた Python バイト文字列" "を返します。\n" "文字列は常に BOM マークで始まります。\n" "エラーハンドラは \"strict\" です。\n" "codec が例外を発生させたときは ``NULL`` を返します。" #: ../../c-api/unicode.rst:1283 msgid "UTF-16 Codecs" msgstr "UTF-16 Codecs" #: ../../c-api/unicode.rst:1285 msgid "These are the UTF-16 codec APIs:" msgstr "以下は UTF-16 codec の APIです:" #: ../../c-api/unicode.rst:1291 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" "UTF-16 でエンコードされたバッファ *s* から *size* バイトだけデコードして、結" "果を Unicode オブジェクトで返します。 *errors* は (``NULL`` でない場合) エ" "ラー処理方法を定義します。デフォルト値は \"strict\" です。" #: ../../c-api/unicode.rst:1302 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " "is not copied into the resulting Unicode string. If ``*byteorder`` is " "``-1`` or ``1``, any byte order mark is copied to the output (where it will " "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" "``*byteorder`` が 0 で、入力データの先頭2バイトがバイトオーダーマーク (BOM) " "だった場合、デコーダは BOM が示すバイトオーダーに切り替え、そのBOMを結果の " "Unicode 文字列にコピーしません。 ``*byteorder`` が ``-1`` か ``1`` だった場" "合、すべてのBOMは出力へコピーされます (出力では ``\\ufeff`` か ``\\ufffe`` の" "どちらかになるでしょう)。" #: ../../c-api/unicode.rst:1308 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" "デコードが完了した後、入力データの終端に来た時点でのバイトオーダーを " "``*byteorder`` にセットします。" #: ../../c-api/unicode.rst:1319 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " "treat trailing incomplete UTF-16 byte sequences (such as an odd number of " "bytes or a split surrogate pair) as an error. Those bytes will not be " "decoded and the number of bytes that have been decoded will be stored in " "*consumed*." msgstr "" "*consumed* が ``NULL`` の場合、 :c:func:`PyUnicode_DecodeUTF16` と同じように" "動作します。 *consumed* が ``NULL`` でない場合、 :c:func:" "`PyUnicode_DecodeUTF16Stateful` は末尾の不完全な UTF-16 バイト列 (奇数長のバ" "イト列や分割されたサロゲートペア) をエラーとみなしません。これらのバイト列は" "デコードされず、デコードされたバイト数を *consumed* に返します。" #: ../../c-api/unicode.rst:1328 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" "ネイティブバイトオーダーで UTF-16 エンコーディングされた Python バイト文字列" "を返します。\n" "文字列は常に BOM マークで始まります。\n" "エラーハンドラは \"strict\" です。\n" "codec が例外を発生させたときは ``NULL`` を返します。" #: ../../c-api/unicode.rst:1334 msgid "UTF-7 Codecs" msgstr "UTF-7 Codecs" #: ../../c-api/unicode.rst:1336 msgid "These are the UTF-7 codec APIs:" msgstr "以下は UTF-7 codec の API です:" #: ../../c-api/unicode.rst:1341 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" #: ../../c-api/unicode.rst:1348 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " "not be treated as an error. Those bytes will not be decoded and the number " "of bytes that have been decoded will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` のとき、 :c:func:`PyUnicode_DecodeUTF7` と同じように動" "作します。 *consumed* が ``NULL`` でないとき、末尾の不完全な UTF-7 base-64 部" "分をエラーとしません。不完全な部分のバイト列はデコードせずに、デコードしたバ" "イト数を *consumed* に格納します。" #: ../../c-api/unicode.rst:1355 msgid "Unicode-Escape Codecs" msgstr "Unicode-Escape Codecs" #: ../../c-api/unicode.rst:1357 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "以下は \"Unicode Escape\" codec の API です:" #: ../../c-api/unicode.rst:1363 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" #: ../../c-api/unicode.rst:1369 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" "Unicode-Escape を使い Unicode オブジェクトをエンコードし、結果を bytes オブ" "ジェクトとして返します。\n" "エラー処理は \"strict\" です。\n" "codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1375 msgid "Raw-Unicode-Escape Codecs" msgstr "Raw-Unicode-Escape Codecs" #: ../../c-api/unicode.rst:1377 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "以下は \"Raw Unicode Escape\" codec の APIです:" #: ../../c-api/unicode.rst:1383 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" #: ../../c-api/unicode.rst:1389 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" "Raw-Unicode-Escape を使い Unicode オブジェクトをエンコードし、結果を bytes オ" "ブジェクトとして返します。\n" "エラー処理は \"strict\" です。\n" "codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1395 msgid "Latin-1 Codecs" msgstr "Latin-1 Codecs" #: ../../c-api/unicode.rst:1397 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" "以下は Latin-1 codec の APIです: Latin-1 は、 Unicode 序数の最初の 256 個に対" "応し、エンコード時にはこの 256 個だけを受理します。" #: ../../c-api/unicode.rst:1403 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" "Latin-1 でエンコードされた *size* バイトの文字列 *str* から Unicode オブジェ" "クトを生成します。codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1409 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" "Latin-1 で Unicode オブジェクトをエンコードし、結果を Python bytes オブジェク" "トとして返します。\n" "エラー処理は \"strict\" です。 codec が例外を送出した場合には ``NULL`` を返し" "ます。" #: ../../c-api/unicode.rst:1415 msgid "ASCII Codecs" msgstr "ASCII Codecs" #: ../../c-api/unicode.rst:1417 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" "以下は ASCII codec の APIです。 7 ビットの ASCII データだけを受理します。その" "他のコードはエラーになります。" #: ../../c-api/unicode.rst:1423 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" #: ../../c-api/unicode.rst:1429 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" "ASCII で Unicode オブジェクトをエンコードし、結果を Python bytes オブジェクト" "として返します。\n" "エラー処理は \"strict\" です。\n" "codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1435 msgid "Character Map Codecs" msgstr "Character Map Codecs" #: ../../c-api/unicode.rst:1437 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " "codecs included in the :mod:`!encodings` package). The codec uses mappings " "to encode and decode characters. The mapping objects provided must support " "the :meth:`~object.__getitem__` mapping interface; dictionaries and " "sequences work well." msgstr "" "この codec は、多くの様々な codec を実装する際に使われるという点で特殊な " "codec です (実際、 :mod:`!encodings` パッケージに入っている標準 codecs のほと" "んどは、この codec を使っています)。\n" "この codec は、文字のエンコードやデコードに対応表を使います。\n" "提供される対応表のオブジェクトは :meth:`~object.__getitem__` マッピングイン" "ターフェースをサポートしていなければなりません; 辞書やシーケンスがそれに適し" "ています。" #: ../../c-api/unicode.rst:1443 msgid "These are the mapping codec APIs:" msgstr "以下は mapping codec の APIです:" #: ../../c-api/unicode.rst:1448 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" "与えられた *mapping* オブジェクトを使って、 *size* バイトのエンコードされた文" "字列 *str* をデコードして Unicode オブジェクトを作成します。\n" "codec が例外を発生させたときは ``NULL`` を返します。" #: ../../c-api/unicode.rst:1452 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " "strings, integers (which are then interpreted as Unicode ordinals) or " "``None``. Unmapped data bytes -- ones which cause a :exc:`LookupError`, as " "well as ones which get mapped to ``None``, ``0xFFFE`` or ``'\\ufffe'``, are " "treated as undefined mappings and cause an error." msgstr "" #: ../../c-api/unicode.rst:1463 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" "Unicode オブジェクトを *mapping* に指定されたオブジェクトを使ってエンコード" "し、結果を bytes オブジェクトとして返します。エラー処理は \"strict\" です。 " "codec が例外を送出した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1467 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " "ordinals (ones which cause a :exc:`LookupError`) as well as mapped to " "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" #: ../../c-api/unicode.rst:1473 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" "以下の codec API は Unicode から Unicode への対応付けを行う特殊なものです。" #: ../../c-api/unicode.rst:1477 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" "文字列に文字対応表 *table* を適用して変換し、変換結果を Unicode オブジェクト" "で返します。codec が例外を発行した場合には ``NULL`` を返します。" #: ../../c-api/unicode.rst:1481 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" "対応表は、Unicode 序数を表す整数を Unicode 序数を表す整数または ``None`` (そ" "の文字を削除する) に対応付けなければなりません。" #: ../../c-api/unicode.rst:1484 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" #: ../../c-api/unicode.rst:1488 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" "*errors* は codecs で通常使われるのと同じ意味を持ちます。 *errors* は " "``NULL`` にしてもよく、デフォルトエラー処理の使用を意味します。" #: ../../c-api/unicode.rst:1493 msgid "MBCS codecs for Windows" msgstr "Windows 用の MBCS codec" #: ../../c-api/unicode.rst:1495 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " "MBCS (or DBCS) is a class of encodings, not just one. The target encoding " "is defined by the user settings on the machine running the codec." msgstr "" "以下は MBCS codec の API です。この codec は現在のところ、 Windows 上だけで利" "用でき、変換の実装には Win32 MBCS 変換機構 (Win32 MBCS converter) を使ってい" "ます。 MBCS (または DBCS) はエンコード方式の種類 (class) を表す言葉で、単一の" "エンコード方式を表すわけでなないので注意してください。利用されるエンコード方" "式 (target encoding) は、 codec を動作させているマシン上のユーザ設定で定義さ" "れています。" #: ../../c-api/unicode.rst:1502 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" #: ../../c-api/unicode.rst:1509 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " "decode trailing lead byte and the number of bytes that have been decoded " "will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` のとき、 :c:func:`PyUnicode_DecodeMBCS` と同じ動作をし" "ます。 *consumed* が ``NULL`` でないとき、 :c:func:" "`PyUnicode_DecodeMBCSStateful` は文字列の最後にあるマルチバイト文字の前半バイ" "トをデコードせず、 *consumed* にデコードしたバイト数を格納します。" #: ../../c-api/unicode.rst:1518 msgid "" "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " "specified by *code_page*." msgstr "" #: ../../c-api/unicode.rst:1524 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" "MBCS で Unicode オブジェクトをエンコードし、結果を Python バイト列オブジェク" "トとして返します。エラー処理は \"strict\" です。 codec が例外を送出した場合に" "は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1531 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" #: ../../c-api/unicode.rst:1541 msgid "Methods and Slot Functions" msgstr "メソッドおよびスロット関数 (slot function)" #: ../../c-api/unicode.rst:1543 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" "以下の API は Unicode オブジェクトおよび文字列を入力に取り (説明では、どちら" "も文字列と表記しています)、場合に応じて Unicode オブジェクトか整数を返す機能" "を持っています。" #: ../../c-api/unicode.rst:1547 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" "これらの関数は全て、例外が発生した場合には ``NULL`` または ``-1`` を返しま" "す。" #: ../../c-api/unicode.rst:1552 msgid "Concat two strings giving a new Unicode string." msgstr "二つの文字列を結合して、新たな Unicode 文字列を生成します。" #: ../../c-api/unicode.rst:1557 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " "occur at the given separator. At most *maxsplit* splits will be done. If " "negative, no limit is set. Separators are not included in the resulting " "list." msgstr "" "Unicode 文字列のリストを分割して、 Unicode 文字列からなるリストを返します。 " "*sep* が ``NULL`` の場合、全ての空白文字を使って分割を行います。それ以外の場" "合、指定された文字を使って分割を行います。最大で *maxsplit* 個までの分割を行" "います。 *maxsplit* が負ならば分割数に制限を設けません。分割結果のリスト内に" "は分割文字は含みません。" #: ../../c-api/unicode.rst:1562 ../../c-api/unicode.rst:1572 #: ../../c-api/unicode.rst:1593 ../../c-api/unicode.rst:1606 msgid "On error, return ``NULL`` with an exception set." msgstr "" #: ../../c-api/unicode.rst:1564 msgid "Equivalent to :py:meth:`str.split`." msgstr "" #: ../../c-api/unicode.rst:1569 msgid "" "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " "at the end of the string." msgstr "" #: ../../c-api/unicode.rst:1574 msgid "Equivalent to :py:meth:`str.rsplit`." msgstr "" #: ../../c-api/unicode.rst:1579 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" #: ../../c-api/unicode.rst:1586 msgid "" "Split a Unicode string at the first occurrence of *sep*, and return a 3-" "tuple containing the part before the separator, the separator itself, and " "the part after the separator. If the separator is not found, return a 3-" "tuple containing the string itself, followed by two empty strings." msgstr "" #: ../../c-api/unicode.rst:1591 ../../c-api/unicode.rst:1604 msgid "*sep* must not be empty." msgstr "" #: ../../c-api/unicode.rst:1595 msgid "Equivalent to :py:meth:`str.partition`." msgstr "" #: ../../c-api/unicode.rst:1600 msgid "" "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " "last occurrence of *sep*. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" #: ../../c-api/unicode.rst:1608 msgid "Equivalent to :py:meth:`str.rpartition`." msgstr "" #: ../../c-api/unicode.rst:1613 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" "指定した *separator* で文字列からなるシーケンスを連結 (join) し、連結結果を " "Unicode 文字列で返します。" #: ../../c-api/unicode.rst:1620 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" #: ../../c-api/unicode.rst:1628 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " "*direction* == ``-1`` a backward search). The return value is the index of " "the first match; a value of ``-1`` indicates that no match was found, and " "``-2`` indicates that an error occurred and an exception has been set." msgstr "" "``unicode[start:end]`` 中に *substr* が最初に出現する場所を返します。\n" "このとき指定された検索方向 *direction* (*direction* == ``1`` は順方向検索、 " "*direction* == ``-1`` は逆方向検索) で検索します。\n" "戻り値は最初にマッチが見つかった場所のインデックスです; 戻り値 ``-1`` はマッ" "チが見つからなかったことを表し、 ``-2`` はエラーが発生して例外情報が設定され" "ていることを表します。" #: ../../c-api/unicode.rst:1638 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " "search, *direction* == ``-1`` a backward search). The return value is the " "index of the first match; a value of ``-1`` indicates that no match was " "found, and ``-2`` indicates that an error occurred and an exception has been " "set." msgstr "" "``unicode[start:end]`` 中に文字 *ch* が最初に出現する場所を返します。\n" "このとき指定された検索方向 *direction* (*direction* == ``1`` は順方向検索、 " "*direction* == ``-1`` は逆方向検索) で検索します。\n" "戻り値は最初にマッチが見つかった場所のインデックスです; 戻り値 ``-1`` はマッ" "チが見つからなかったことを表し、 ``-2`` はエラーが発生して例外情報が設定され" "ていることを表します。" #: ../../c-api/unicode.rst:1646 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" #: ../../c-api/unicode.rst:1653 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" "``unicode[start:end]`` に *substr* が重複することなく出現する回数を返します。" "エラーが発生した場合には ``-1`` を返します。" #: ../../c-api/unicode.rst:1660 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" "*unicode* 中に出現する *substr* を最大で *maxcount* 個 *replstr* に置換し、置" "換結果である Unicode オブジェクトを返します。\n" "*maxcount* == ``-1`` にすると、文字列中に現れる全ての *substr* を置換します。" #: ../../c-api/unicode.rst:1667 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" "二つの文字列を比較して、左引数が右引数より小さい場合、左右引数が等価の場合、" "左引数が右引数より大きい場合に対して、それぞれ ``-1``, ``0``, ``1`` を返しま" "す。" #: ../../c-api/unicode.rst:1670 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" "この関数は、失敗したときに ``-1`` を返すので、 :c:func:`PyErr_Occurred` を呼" "び出して、エラーをチェックすべきです。" #: ../../c-api/unicode.rst:1675 msgid "The :c:func:`PyUnicode_Equal` function." msgstr "" #: ../../c-api/unicode.rst:1680 msgid "Test if two strings are equal:" msgstr "" #: ../../c-api/unicode.rst:1682 msgid "Return ``1`` if *a* is equal to *b*." msgstr "" #: ../../c-api/unicode.rst:1683 msgid "Return ``0`` if *a* is not equal to *b*." msgstr "" #: ../../c-api/unicode.rst:1684 msgid "" "Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :" "class:`str` object." msgstr "" #: ../../c-api/unicode.rst:1687 msgid "The function always succeeds if *a* and *b* are :class:`str` objects." msgstr "" #: ../../c-api/unicode.rst:1689 msgid "" "The function works for :class:`str` subclasses, but does not honor custom " "``__eq__()`` method." msgstr "" #: ../../c-api/unicode.rst:1694 msgid "The :c:func:`PyUnicode_Compare` function." msgstr "" #: ../../c-api/unicode.rst:1701 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " "(``0``) otherwise. If the Unicode object contains surrogate code points " "(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " "is returned." msgstr "" #: ../../c-api/unicode.rst:1708 ../../c-api/unicode.rst:1729 msgid "This function does not raise exceptions." msgstr "この関数は例外を送出しません。" #: ../../c-api/unicode.rst:1715 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" #: ../../c-api/unicode.rst:1724 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " "pass only ASCII-encoded strings, but the function interprets the input " "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" "Unicode オブジェクト *unicode* と *string* を比較して、左引数が右引数より小さ" "い場合、左右引数が等価の場合、左引数が右引数より大きい場合に対して、それぞれ " "``-1``, ``0``, ``1`` を返します。\n" "ASCII エンコードされた文字列だけを渡すのが最も良いですが、入力文字列に非 " "ASCII 文字が含まれている場合は ISO-8859-1 として解釈します。" #: ../../c-api/unicode.rst:1734 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "二つのUnicode文字列を比較して、下のうちの一つを返します:" #: ../../c-api/unicode.rst:1736 msgid "``NULL`` in case an exception was raised" msgstr "``NULL`` を、例外が発生したときに返します。" #: ../../c-api/unicode.rst:1737 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" ":c:data:`Py_True` もしくは :c:data:`Py_False` を、正しく比較できた時に返しま" "す。" #: ../../c-api/unicode.rst:1738 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" #: ../../c-api/unicode.rst:1740 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" #: ../../c-api/unicode.rst:1746 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" "新たな文字列オブジェクトを *format* および *args* から生成して返します; この" "メソッドは ``format % args`` のようなものです。" #: ../../c-api/unicode.rst:1752 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" "*substr* が *unicode* 内にあるか調べ、その結果に応じて真または偽を返します。" #: ../../c-api/unicode.rst:1755 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" "*substr* は単要素の Unicode 文字に型強制できなければなりません。エラーが生じ" "た場合には ``-1`` を返します。" #: ../../c-api/unicode.rst:1761 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " "If there is an existing interned string that is the same as :c:expr:" "`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " "the old string object and creating a new :term:`strong reference` to the " "interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " "interns it." msgstr "" #: ../../c-api/unicode.rst:1768 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " "after the call you no longer own the passed-in reference, but you newly own " "the result.)" msgstr "" #: ../../c-api/unicode.rst:1773 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" #: ../../c-api/unicode.rst:1776 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" #: ../../c-api/unicode.rst:1780 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" #: ../../c-api/unicode.rst:1786 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" #: ../../c-api/unicode.rst:1789 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" #: ../../c-api/unicode.rst:1793 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " "prefer calling :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace` directly." msgstr "" #: ../../c-api/unicode.rst:1802 msgid "" "Return a non-zero value if *str* is interned, zero if not. The *str* " "argument must be a string; this is not checked. This function always " "succeeds." msgstr "" #: ../../c-api/unicode.rst:1808 msgid "" "A non-zero return value may carry additional information about *how* the " "string is interned. The meaning of such non-zero values, as well as each " "specific string's intern-related details, may change between CPython " "versions." msgstr "" #: ../../c-api/unicode.rst:1815 msgid "PyUnicodeWriter" msgstr "" #: ../../c-api/unicode.rst:1817 msgid "" "The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:" "`str` object." msgstr "" #: ../../c-api/unicode.rst:1824 msgid "A Unicode writer instance." msgstr "" #: ../../c-api/unicode.rst:1826 msgid "" "The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on " "success, or :c:func:`PyUnicodeWriter_Discard` on error." msgstr "" #: ../../c-api/unicode.rst:1829 msgid "" "The API is **not thread safe**. To share a writer with multiple threads, a " "critical section or a lock is needed." msgstr "" #: ../../c-api/unicode.rst:1834 msgid "Create a Unicode writer instance." msgstr "" #: ../../c-api/unicode.rst:1836 msgid "*length* must be greater than or equal to ``0``." msgstr "" #: ../../c-api/unicode.rst:1838 msgid "" "If *length* is greater than ``0``, preallocate an internal buffer of " "*length* characters." msgstr "" #: ../../c-api/unicode.rst:1841 ../../c-api/unicode.rst:1847 msgid "Set an exception and return ``NULL`` on error." msgstr "" #: ../../c-api/unicode.rst:1845 msgid "" "Return the final Python :class:`str` object and destroy the writer instance." msgstr "" #: ../../c-api/unicode.rst:1849 ../../c-api/unicode.rst:1857 msgid "The writer instance is invalid after this call." msgstr "" #: ../../c-api/unicode.rst:1853 msgid "Discard the internal Unicode buffer and destroy the writer instance." msgstr "" #: ../../c-api/unicode.rst:1855 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "" #: ../../c-api/unicode.rst:1861 msgid "Write the single Unicode character *ch* into *writer*." msgstr "" #: ../../c-api/unicode.rst:1863 ../../c-api/unicode.rst:1873 #: ../../c-api/unicode.rst:1888 ../../c-api/unicode.rst:1898 #: ../../c-api/unicode.rst:1910 ../../c-api/unicode.rst:1917 #: ../../c-api/unicode.rst:1930 ../../c-api/unicode.rst:1945 #: ../../c-api/unicode.rst:1952 ../../c-api/unicode.rst:1971 msgid "" "On success, return ``0``. On error, set an exception, leave the writer " "unchanged, and return ``-1``." msgstr "" #: ../../c-api/unicode.rst:1868 msgid "" "Decode the string *str* from UTF-8 in strict mode and write the output into " "*writer*." msgstr "" #: ../../c-api/unicode.rst:1870 ../../c-api/unicode.rst:1882 #: ../../c-api/unicode.rst:1960 msgid "" "*size* is the string length in bytes. If *size* is equal to ``-1``, call " "``strlen(str)`` to get the string length." msgstr "" #: ../../c-api/unicode.rst:1876 msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." msgstr "" #: ../../c-api/unicode.rst:1880 msgid "Write the ASCII string *str* into *writer*." msgstr "" #: ../../c-api/unicode.rst:1885 msgid "" "*str* must only contain ASCII characters. The behavior is undefined if *str* " "contains non-ASCII characters." msgstr "" #: ../../c-api/unicode.rst:1893 msgid "Write the wide string *str* into *writer*." msgstr "" #: ../../c-api/unicode.rst:1895 msgid "" "*size* is a number of wide characters. If *size* is equal to ``-1``, call " "``wcslen(str)`` to get the string length." msgstr "" #: ../../c-api/unicode.rst:1903 msgid "Write the UCS4 string *str* into *writer*." msgstr "" #: ../../c-api/unicode.rst:1905 msgid "*size* is a number of UCS4 characters." msgstr "" #: ../../c-api/unicode.rst:1907 msgid "" "All characters must be in range [U+0000; U+10ffff]. If the string contains " "invalid characters, the behavior is undefined." msgstr "" #: ../../c-api/unicode.rst:1915 msgid "" "Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." msgstr "" #: ../../c-api/unicode.rst:1920 msgid "" "To write a :class:`str` subclass which overrides the :meth:`~object.__str__` " "method, :c:func:`PyUnicode_FromObject` can be used to get the original " "string." msgstr "" #: ../../c-api/unicode.rst:1926 msgid "" "Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." msgstr "" #: ../../c-api/unicode.rst:1928 msgid "If *obj* is ``NULL``, write the string ``\"\"`` into *writer*." msgstr "" #: ../../c-api/unicode.rst:1935 msgid "Added support for ``NULL``." msgstr "" #: ../../c-api/unicode.rst:1939 msgid "Write the substring ``str[start:end]`` into *writer*." msgstr "" #: ../../c-api/unicode.rst:1941 msgid "" "*str* must be Python :class:`str` object. *start* must be greater than or " "equal to 0, and less than or equal to *end*. *end* must be less than or " "equal to *str* length." msgstr "" #: ../../c-api/unicode.rst:1950 msgid "" "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " "into *writer*." msgstr "" #: ../../c-api/unicode.rst:1957 msgid "" "Decode the string *str* from UTF-8 with *errors* error handler and write the " "output into *writer*." msgstr "" #: ../../c-api/unicode.rst:1963 msgid "" "*errors* is an :ref:`error handler ` name, such as " "``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." msgstr "" #: ../../c-api/unicode.rst:1966 msgid "" "If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded " "bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 " "byte sequences as an error." msgstr "" #: ../../c-api/unicode.rst:1974 msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." msgstr "" #: ../../c-api/unicode.rst:1977 msgid "Deprecated API" msgstr "" #: ../../c-api/unicode.rst:1979 msgid "The following API is deprecated." msgstr "" #: ../../c-api/unicode.rst:1983 msgid "" "This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " "type depending on the platform. Please use :c:type:`wchar_t` directly " "instead." msgstr "" #: ../../c-api/unicode.rst:1987 msgid "" "In previous versions, this was a 16-bit type or a 32-bit type depending on " "whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " "build time." msgstr "" "以前のバージョンでは、Pythonをビルドした際に \"narrow\" または \"wide\" " "Unicode バージョンのどちらを選択したかによって、 16ビットか32ビットのどちらか" "の型になっていました。" #: ../../c-api/unicode.rst:1997 msgid "" "Do nothing and return ``0``. This API is kept only for backward " "compatibility, but there are no plans to remove it." msgstr "" #: ../../c-api/unicode.rst:2003 msgid "" "This API does nothing since Python 3.12. Previously, this needed to be " "called for each string created using the old API (:c:func:`!" "PyUnicode_FromUnicode` or similar)." msgstr "" #: ../../c-api/unicode.rst:2011 msgid "" "Do nothing and return ``1``. This API is kept only for backward " "compatibility, but there are no plans to remove it." msgstr "" #: ../../c-api/unicode.rst:2017 msgid "" "This API does nothing since Python 3.12. Previously, this could be called to " "check if :c:func:`PyUnicode_READY` is necessary." msgstr ""