# Copyright (C) 2001-2020, Python Software Foundation # This file is distributed under the same license as the Python package. # Maintained by the python-doc-es workteam. # docs-es@python.org / # https://mail.python.org/mailman3/lists/docs-es.python.org/ # Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to # get the list of volunteers # msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 19:43+0200\n" "PO-Revision-Date: 2021-08-04 20:36+0200\n" "Last-Translator: Cristián Maureira-Fredes \n" "Language: es\n" "Language-Team: python-doc-es (https://mail.python.org/mailman3/lists/docs-es." "python.org)\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.13.0\n" #: ../Doc/howto/unicode.rst:5 msgid "Unicode HOWTO" msgstr "CÓMO (*HOWTO*) Unicode" #: ../Doc/howto/unicode.rst msgid "Release" msgstr "Lanzamiento" #: ../Doc/howto/unicode.rst:7 msgid "1.12" msgstr "1.12" #: ../Doc/howto/unicode.rst:9 msgid "" "This HOWTO discusses Python's support for the Unicode specification for " "representing textual data, and explains various problems that people " "commonly encounter when trying to work with Unicode." msgstr "" "Este CÓMO (*HOWTO*) debate el soporte de Python para la especificación " "Unicode para representar datos textuales, y explica varios problemas que " "comúnmente encuentra la gente cuando tratan de trabajar con Unicode." #: ../Doc/howto/unicode.rst:15 msgid "Introduction to Unicode" msgstr "Introducción a Unicode" #: ../Doc/howto/unicode.rst:18 msgid "Definitions" msgstr "Definiciones" #: ../Doc/howto/unicode.rst:20 msgid "" "Today's programs need to be able to handle a wide variety of characters. " "Applications are often internationalized to display messages and output in a " "variety of user-selectable languages; the same program might need to output " "an error message in English, French, Japanese, Hebrew, or Russian. Web " "content can be written in any of these languages and can also include a " "variety of emoji symbols. Python's string type uses the Unicode Standard for " "representing characters, which lets Python programs work with all these " "different possible characters." msgstr "" "Los programas de hoy necesitan poder manejar una amplia variedad de " "caracteres. Las aplicaciones son a menudo internacionalizadas para mostrar " "mensajes y resultados en una variedad de idiomas seleccionables por el " "usuario; Es posible que el mismo programa necesite generar un mensaje de " "error en inglés, francés, japonés, hebreo o ruso. El contenido web se puede " "escribir en cualquiera de estos idiomas y también puede incluir una variedad " "de símbolos *emoji*. El tipo cadena de Python utiliza el estándar Unicode " "para representar caracteres, lo que permite a los programas de Python " "trabajar con todos estos caracteres posibles diferentes." #: ../Doc/howto/unicode.rst:30 msgid "" "Unicode (https://www.unicode.org/) is a specification that aims to list " "every character used by human languages and give each character its own " "unique code. The Unicode specifications are continually revised and updated " "to add new languages and symbols." msgstr "" "Unicode (https://www.unicode.org/) es una especificación que apunta a listar " "cada carácter usado por lenguajes humanos y darle a cada carácter su propio " "código único. La especificación Unicode es continuamente revisada y " "actualizada para añadir nuevos lenguajes y símbolos." #: ../Doc/howto/unicode.rst:35 msgid "" "A **character** is the smallest possible component of a text. 'A', 'B', " "'C', etc., are all different characters. So are 'È' and 'Í'. Characters " "vary depending on the language or context you're talking about. For " "example, there's a character for \"Roman Numeral One\", 'Ⅰ', that's separate " "from the uppercase letter 'I'. They'll usually look the same, but these are " "two different characters that have different meanings." msgstr "" "Un **carácter** es el componente mas pequeño posible de un texto. 'A', 'B', " "'C', etc., son todos diferentes caracteres. También lo son *'È'* e *'Í'*. " "Los caracteres varían dependiendo del lenguaje o del contexto en el que " "estás hablando. Por ejemplo, Existe un carácter para el \"Número Uno " "Romano\", 'I', que es distinto de la letra 'I' mayúscula. Estos usualmente " "lucen igual, pero son dos caracteres diferentes que tienen distintos " "significados." #: ../Doc/howto/unicode.rst:42 msgid "" "The Unicode standard describes how characters are represented by **code " "points**. A code point value is an integer in the range 0 to 0x10FFFF " "(about 1.1 million values, the `actual number assigned `_ is less than that). In the standard and in " "this document, a code point is written using the notation ``U+265E`` to mean " "the character with value ``0x265e`` (9,822 in decimal)." msgstr "" "El estándar Unicode describe cómo se representan los caracteres mediante " "**puntos de código**. Un valor de punto de código es un número entero en el " "rango de 0 a 0x10FFFF (aproximadamente 1.1 millones de valores, el `número " "real asignado `_ es menor " "que eso). En el estándar y en este documento, un punto de código se escribe " "usando la notación ``U+265E`` para significar el carácter con valor " "``0x265e`` (9,822 en decimal)." #: ../Doc/howto/unicode.rst:50 msgid "" "The Unicode standard contains a lot of tables listing characters and their " "corresponding code points:" msgstr "" "El estándar Unicode contiene muchas tablas que enumeran caracteres y sus " "puntos de código correspondientes:" #: ../Doc/howto/unicode.rst:71 msgid "" "Strictly, these definitions imply that it's meaningless to say 'this is " "character ``U+265E``'. ``U+265E`` is a code point, which represents some " "particular character; in this case, it represents the character 'BLACK CHESS " "KNIGHT', '♞'. In informal contexts, this distinction between code points " "and characters will sometimes be forgotten." msgstr "" "Estrictamente, estas definiciones implican que no tiene sentido decir 'este " "es el carácter ``U+265E``. ``U+265E`` es un punto de código, que representa " "algún carácter en particular; en este caso, representa el carácter " "'CABALLERO AJEDREZ NEGRO', '♞'. En contextos informales, esta distinción " "entre puntos de código y caracteres a veces se olvidará." #: ../Doc/howto/unicode.rst:78 msgid "" "A character is represented on a screen or on paper by a set of graphical " "elements that's called a **glyph**. The glyph for an uppercase A, for " "example, is two diagonal strokes and a horizontal stroke, though the exact " "details will depend on the font being used. Most Python code doesn't need " "to worry about glyphs; figuring out the correct glyph to display is " "generally the job of a GUI toolkit or a terminal's font renderer." msgstr "" "Un carácter es representado en una pantalla o en papel por un conjunto de " "elementos gráficos llamado **glifo**. El glifo para una A mayúscula, por " "ejemplo, es dos trazos diagonales y uno horizontal, aunque los detalles " "exactos van a depender de la fuente utilizada. La mayoría del código de " "Python no necesita preocuparse por los glifos; averiguar el glifo correcto " "para mostrar es generalmente el trabajo de un kit de herramientas GUI o el " "renderizador de fuentes de una terminal." #: ../Doc/howto/unicode.rst:87 msgid "Encodings" msgstr "Codificaciones" #: ../Doc/howto/unicode.rst:89 msgid "" "To summarize the previous section: a Unicode string is a sequence of code " "points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). " "This sequence of code points needs to be represented in memory as a set of " "**code units**, and **code units** are then mapped to 8-bit bytes. The " "rules for translating a Unicode string into a sequence of bytes are called a " "**character encoding**, or just an **encoding**." msgstr "" "Para resumir la sección anterior: Una cadena Unicode es una secuencia de " "código de posiciones que son números desde 0 hasta ``0x10FFFF`` (1114111 " "decimal). Esta secuencia de código de posiciones necesita ser representada " "en memoria como un conjunto de **unidades de código**, y las **unidades de " "código** son mapeadas a bytes de 8 bits. Las reglas para traducir una cadena " "Unicode a una secuencia de bytes son llamadas **Codificación de carácter**, " "o sólo una **codificación**." #: ../Doc/howto/unicode.rst:97 msgid "" "The first encoding you might think of is using 32-bit integers as the code " "unit, and then using the CPU's representation of 32-bit integers. In this " "representation, the string \"Python\" might look like this:" msgstr "" "La primera codificación en que podrías pensar es usar enteros de 32 bits " "como unidad de código, y luego usar la representación de la CPU de enteros " "de 32 bits. En esta representación, la cadena \"Python\" podría verse así:" #: ../Doc/howto/unicode.rst:107 msgid "" "This representation is straightforward but using it presents a number of " "problems." msgstr "" "Esta representación es sencilla pero utilizarla presenta una serie de " "problemas." #: ../Doc/howto/unicode.rst:110 msgid "It's not portable; different processors order the bytes differently." msgstr "" "No es portable; diferentes procesadores ordenan los bytes de manera " "diferente." #: ../Doc/howto/unicode.rst:112 msgid "" "It's very wasteful of space. In most texts, the majority of the code points " "are less than 127, or less than 255, so a lot of space is occupied by " "``0x00`` bytes. The above string takes 24 bytes compared to the 6 bytes " "needed for an ASCII representation. Increased RAM usage doesn't matter too " "much (desktop computers have gigabytes of RAM, and strings aren't usually " "that large), but expanding our usage of disk and network bandwidth by a " "factor of 4 is intolerable." msgstr "" "Es un desperdicio de espacio. En la mayoría de los textos, la mayoría de los " "códigos de posición son menos de 127, o menos de 255, por lo que una gran " "cantidad de espacio está ocupado por bytes ``0x00``. La cadena anterior toma " "24 bytes en comparación con los 6 bytes necesarios para una representación " "ASCII. El aumento en el uso de RAM no importa demasiado (las computadoras de " "escritorio tienen *gigabytes* de RAM, y las cadenas no suelen ser tan " "grandes), pero expandir nuestro uso del disco y el ancho de banda de la red " "en un factor de 4 es intolerable." #: ../Doc/howto/unicode.rst:120 msgid "" "It's not compatible with existing C functions such as ``strlen()``, so a new " "family of wide string functions would need to be used." msgstr "" "No es compatible con funciones existentes en C como ``strlen()``, para eso " "se necesitaría una nueva familia de funciones de cadenas." #: ../Doc/howto/unicode.rst:123 msgid "" "Therefore this encoding isn't used very much, and people instead choose " "other encodings that are more efficient and convenient, such as UTF-8." msgstr "" "Por lo tanto esta codificación no es muy utilizada, y la gente prefiere " "elegir codificaciones que son mas eficientes y convenientes, como UTF-8." #: ../Doc/howto/unicode.rst:126 msgid "" "UTF-8 is one of the most commonly used encodings, and Python often defaults " "to using it. UTF stands for \"Unicode Transformation Format\", and the '8' " "means that 8-bit values are used in the encoding. (There are also UTF-16 " "and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 " "uses the following rules:" msgstr "" "UTF-8 es una de las codificaciones mas utilizadas, y Python generalmente la " "usa de forma predeterminada. UTF significa *\"Unicode Transformation " "Format\"*, y el \"8\" significa que se utilizan valores de 8 bits en la " "codificación. (También hay codificaciones UTF-16 y UTF-32, pero son menos " "frecuentes que UTF-8.) UTF-8 usa las siguientes reglas:" #: ../Doc/howto/unicode.rst:132 msgid "" "If the code point is < 128, it's represented by the corresponding byte value." msgstr "" "Si el código de posición is < 128, es representado por el valor de byte " "correspondiente." #: ../Doc/howto/unicode.rst:133 msgid "" "If the code point is >= 128, it's turned into a sequence of two, three, or " "four bytes, where each byte of the sequence is between 128 and 255." msgstr "" "Si el código de posición es >= 128, se transforma en una secuencia de dos, " "tres, o cuatro bytes, donde cada byte de la secuencia está entre 128 y 255." #: ../Doc/howto/unicode.rst:136 msgid "UTF-8 has several convenient properties:" msgstr "UTF-8 tiene varias propiedades convenientes:" #: ../Doc/howto/unicode.rst:138 msgid "It can handle any Unicode code point." msgstr "Puede manejar cualquier punto de código Unicode." #: ../Doc/howto/unicode.rst:139 msgid "" "A Unicode string is turned into a sequence of bytes that contains embedded " "zero bytes only where they represent the null character (U+0000). This means " "that UTF-8 strings can be processed by C functions such as ``strcpy()`` and " "sent through protocols that can't handle zero bytes for anything other than " "end-of-string markers." msgstr "" "Una cadena Unicode se convierte en una secuencia de bytes que contiene cero " "bytes incrustados solo donde representan el carácter nulo (U+0000). Esto " "significa que las cadenas UTF-8 pueden ser procesadas por funciones C como " "``strcpy()`` y enviadas a través de protocolos que no pueden manejar cero " "bytes para nada más que marcadores de fin de cadena de caracteres." #: ../Doc/howto/unicode.rst:144 msgid "A string of ASCII text is also valid UTF-8 text." msgstr "Una cadena de texto ASCII es también texto UTF-8." #: ../Doc/howto/unicode.rst:145 msgid "" "UTF-8 is fairly compact; the majority of commonly used characters can be " "represented with one or two bytes." msgstr "" "UTF-8 es bastante compacto; La mayoría de los caracteres comúnmente usados " "pueden ser representados con uno o dos bytes." #: ../Doc/howto/unicode.rst:147 msgid "" "If bytes are corrupted or lost, it's possible to determine the start of the " "next UTF-8-encoded code point and resynchronize. It's also unlikely that " "random 8-bit data will look like valid UTF-8." msgstr "" "Si los bytes están corruptos o perdidos, es posible determinar el comienzo " "del próximo código de posición y re-sincronizar. También es poco probable " "que datos aleatorios de 8 bit se vean como UTF-8 válido." #: ../Doc/howto/unicode.rst:150 msgid "" "UTF-8 is a byte oriented encoding. The encoding specifies that each " "character is represented by a specific sequence of one or more bytes. This " "avoids the byte-ordering issues that can occur with integer and word " "oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes " "varies depending on the hardware on which the string was encoded." msgstr "" "UTF-8 es una codificación orientada a bytes. La codificación especifica que " "cada carácter está representado por una secuencia específica de uno o más " "bytes. Esto evita los problemas de ordenamiento de bytes que pueden ocurrir " "con codificaciones orientadas a números enteros y palabras, como UTF-16 y " "UTF-32, donde la secuencia de bytes varía según el hardware en el que se " "codificó la cadena." #: ../Doc/howto/unicode.rst:158 ../Doc/howto/unicode.rst:514 #: ../Doc/howto/unicode.rst:735 msgid "References" msgstr "Referencias" #: ../Doc/howto/unicode.rst:160 msgid "" "The `Unicode Consortium site `_ has character " "charts, a glossary, and PDF versions of the Unicode specification. Be " "prepared for some difficult reading. `A chronology `_ of the origin and development of Unicode is also available on " "the site." msgstr "" "El `sitio del Consorcio Unicode `_ tiene gráficos " "de caracteres, un glosario y versiones en PDF de la especificación Unicode. " "Esté preparado para una lectura difícil. `Una cronología `_ del origen y desarrollo de Unicode también está " "disponible en el sitio." #: ../Doc/howto/unicode.rst:165 msgid "" "On the Computerphile Youtube channel, Tom Scott briefly `discusses the " "history of Unicode and UTF-8 `_ " "(9 minutes 36 seconds)." msgstr "" "En el canal de *Youtube* *Computerphile*, *Tom Scott* `discute brevemente la " "historia de Unicode y UTF-8 `_ " "(9 minutos 36 segundos)." #: ../Doc/howto/unicode.rst:169 #, fuzzy msgid "" "To help understand the standard, Jukka Korpela has written `an introductory " "guide `_ to reading the Unicode " "character tables." msgstr "" "Para ayudar a entender el estándar, *Jukka Korpela* escribió `una guía " "introductoria `_ para leer tablas de " "caracteres Unicode." #: ../Doc/howto/unicode.rst:173 msgid "" "Another `good introductory article `_ was " "written by Joel Spolsky. If this introduction didn't make things clear to " "you, you should try reading this alternate article before continuing." msgstr "" "Otro `buen articulo introductorio `_ fue escrito por *Joel " "Spolsky*. Si esta introducción no aclara las cosas para usted, debería " "tratar leyendo este articulo alternativo antes de continuar." #: ../Doc/howto/unicode.rst:178 msgid "" "Wikipedia entries are often helpful; see the entries for \"`character " "encoding `_\" and `UTF-8 " "`_, for example." msgstr "" "Artículos de *Wikipedia* son a menudo útiles. Mire los artículos para " "\"`codificación de caracteres `_\" y `UTF-8 `_, por ejemplo." #: ../Doc/howto/unicode.rst:184 msgid "Python's Unicode Support" msgstr "Soporte Unicode de Python" #: ../Doc/howto/unicode.rst:186 msgid "" "Now that you've learned the rudiments of Unicode, we can look at Python's " "Unicode features." msgstr "" "Ahora que ya ha aprendido los rudimentos de Unicode, podemos mirar las " "características de Unicode de Python." #: ../Doc/howto/unicode.rst:190 msgid "The String Type" msgstr "El tipo cadena" #: ../Doc/howto/unicode.rst:192 msgid "" "Since Python 3.0, the language's :class:`str` type contains Unicode " "characters, meaning any string created using ``\"unicode rocks!\"``, " "``'unicode rocks!'``, or the triple-quoted string syntax is stored as " "Unicode." msgstr "" "Desde Python 3.0, el tipo :class:`str` del lenguaje contiene caracteres " "Unicode, lo que significa que cualquier cadena creada usando ``\"unicode " "rocks!\"``, ``'unicode rocks!'``, o la sintaxis de cadena entre comillas " "triples es almacenado como Unicode." #: ../Doc/howto/unicode.rst:196 msgid "" "The default encoding for Python source code is UTF-8, so you can simply " "include a Unicode character in a string literal::" msgstr "" "La codificación predeterminada para el código fuente de Python es UTF-8, por " "lo que simplemente puede incluir un carácter Unicode en un literal de cadena " "de caracteres::" #: ../Doc/howto/unicode.rst:206 msgid "" "Side note: Python 3 also supports using Unicode characters in identifiers::" msgstr "" "Nota al margen: Python 3 también soporta el uso de caracteres Unicode en " "identificadores::" #: ../Doc/howto/unicode.rst:212 msgid "" "If you can't enter a particular character in your editor or want to keep the " "source code ASCII-only for some reason, you can also use escape sequences in " "string literals. (Depending on your system, you may see the actual capital-" "delta glyph instead of a \\u escape.) ::" msgstr "" "Si no puede ingresar un carácter en particular en su editor o desea mantener " "el código fuente solo ASCII por alguna razón, también puede usar secuencias " "de escape en cadenas de caracteres literales. (Dependiendo de su sistema, es " "posible que vea el glifo delta de mayúsculas en lugar de un escape \\u)::" #: ../Doc/howto/unicode.rst:224 msgid "" "In addition, one can create a string using the :func:`~bytes.decode` method " "of :class:`bytes`. This method takes an *encoding* argument, such as " "``UTF-8``, and optionally an *errors* argument." msgstr "" "Además, uno puede crear una cadena usando el método :func:`~bytes.decode` de " "la clase :class:`bytes`. Este método recibe una *codificación* como " "argumento, como ``UTF-8``, y opcionalmente un argumento *errores*." #: ../Doc/howto/unicode.rst:228 msgid "" "The *errors* argument specifies the response when the input string can't be " "converted according to the encoding's rules. Legal values for this argument " "are ``'strict'`` (raise a :exc:`UnicodeDecodeError` exception), " "``'replace'`` (use ``U+FFFD``, ``REPLACEMENT CHARACTER``), ``'ignore'`` " "(just leave the character out of the Unicode result), or " "``'backslashreplace'`` (inserts a ``\\xNN`` escape sequence). The following " "examples show the differences::" msgstr "" "El argumento *errores* especifica la respuesta cuando la cadena ingresada no " "puede ser convertida de acuerdo a las reglas de codificación. Los posibles " "valores para este argumento son ``'strict'`` (levanta una excepción :exc:" "`UnicodeDecodeError`), ``'replace'`` (use ``U+FFFD``, ``CARACTER DE " "REEMPLAZO``), ``'ignore'`` (solo deje el carácter fuera del resultado " "Unicode), o ``'backslahsreplace'`` (inserta una secuencia de escape " "``\\xNN``). Los siguientes ejemplos muestran las diferencias ::" #: ../Doc/howto/unicode.rst:248 msgid "" "Encodings are specified as strings containing the encoding's name. Python " "comes with roughly 100 different encodings; see the Python Library Reference " "at :ref:`standard-encodings` for a list. Some encodings have multiple " "names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all " "synonyms for the same encoding." msgstr "" "Las codificaciones son especificadas como cadenas que contienen el nombre de " "la codificación. Python viene con cerca de 100 codificaciones diferentes; " "consulta la referencia de la biblioteca de Python en :ref:`standard-" "encodings` para una lista. Algunas codificaciones tienen múltiples nombres; " "por ejemplo, ``'latin-1'``, ``'iso_8859_1'`` y ``'8859``' son sinónimos para " "la misma codificación." #: ../Doc/howto/unicode.rst:254 msgid "" "One-character Unicode strings can also be created with the :func:`chr` built-" "in function, which takes integers and returns a Unicode string of length 1 " "that contains the corresponding code point. The reverse operation is the " "built-in :func:`ord` function that takes a one-character Unicode string and " "returns the code point value::" msgstr "" "Las cadenas de un solo carácter pueden ser creadas también con la función " "incorporada :func:`chr`, que toma un entero y retorna una cadena Unicode de " "longitud 1 que contiene el correspondiente código de posición. La operación " "inversa es la función incorporada :func:`ord` que toma una cadena Unicode de " "un carácter y retorna el código de posición::" #: ../Doc/howto/unicode.rst:266 msgid "Converting to Bytes" msgstr "Convirtiendo a Bytes" #: ../Doc/howto/unicode.rst:268 msgid "" "The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which " "returns a :class:`bytes` representation of the Unicode string, encoded in " "the requested *encoding*." msgstr "" "El método opuesto a :meth:`bytes.decode` es :meth:`str.encode`, que retorna " "una representación de :class:`bytes` de la cadena Unicode, codificada en la " "codificación solicitada." #: ../Doc/howto/unicode.rst:272 msgid "" "The *errors* parameter is the same as the parameter of the :meth:`~bytes." "decode` method but supports a few more possible handlers. As well as " "``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a " "question mark instead of the unencodable character), there is also " "``'xmlcharrefreplace'`` (inserts an XML character reference), " "``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " "``namereplace`` (inserts a ``\\N{...}`` escape sequence)." msgstr "" "El parámetro *errores* es el mismo que el parámetro del método :meth:`~bytes." "decode` pero soporta algunos manejadores mas." #: ../Doc/howto/unicode.rst:280 msgid "The following example shows the different results::" msgstr "El siguiente ejemplo muestra los diferentes resultados::" #: ../Doc/howto/unicode.rst:301 msgid "" "The low-level routines for registering and accessing the available encodings " "are found in the :mod:`codecs` module. Implementing new encodings also " "requires understanding the :mod:`codecs` module. However, the encoding and " "decoding functions returned by this module are usually more low-level than " "is comfortable, and writing new encodings is a specialized task, so the " "module won't be covered in this HOWTO." msgstr "" "Las rutinas de bajo nivel para registrar y acceder a las codificaciones " "disponibles se encuentran en el módulo :mod:`codecs`. La implementación de " "nuevas codificaciones también requiere comprender el módulo :mod:`codecs`. " "Sin embargo, las funciones de codificación y decodificación retornadas por " "este módulo generalmente son de nivel más bajo de lo que es cómodo, y " "escribir nuevas codificaciones es una tarea especializada, por lo que el " "módulo no se cubrirá en este CÓMO." #: ../Doc/howto/unicode.rst:310 msgid "Unicode Literals in Python Source Code" msgstr "Literales Unicode en código fuente Python" #: ../Doc/howto/unicode.rst:312 msgid "" "In Python source code, specific Unicode code points can be written using the " "``\\u`` escape sequence, which is followed by four hex digits giving the " "code point. The ``\\U`` escape sequence is similar, but expects eight hex " "digits, not four::" msgstr "" "En el código fuente de Python, se pueden escribir puntos de código Unicode " "específicos utilizando la secuencia de escape ``\\u``, que es seguida por " "cuatro dígitos hexadecimales que dan el punto de código. La secuencia de " "escape ``\\U`` es similar, pero espera ocho dígitos hexadecimales, no " "cuatro::" #: ../Doc/howto/unicode.rst:324 msgid "" "Using escape sequences for code points greater than 127 is fine in small " "doses, but becomes an annoyance if you're using many accented characters, as " "you would in a program with messages in French or some other accent-using " "language. You can also assemble strings using the :func:`chr` built-in " "function, but this is even more tedious." msgstr "" "El uso de secuencias de escape para puntos de código superiores a 127 está " "bien en pequeñas dosis, pero se convierte en una molestia si está utilizando " "muchos caracteres acentuados, como lo haría en un programa con mensajes en " "francés o algún otro lenguaje que utilice acento. También puede ensamblar " "cadenas usando la función incorporada :func:`chr`, pero esto es aún más " "tedioso." #: ../Doc/howto/unicode.rst:330 msgid "" "Ideally, you'd want to be able to write literals in your language's natural " "encoding. You could then edit Python source code with your favorite editor " "which would display the accented characters naturally, and have the right " "characters used at runtime." msgstr "" "Idealmente, desearía poder escribir literales en la codificación natural de " "su idioma. Luego, puede editar el código fuente de Python con su editor " "favorito, que mostrará los caracteres acentuados de forma natural y tendrá " "los caracteres correctos utilizados en tiempo de ejecución." #: ../Doc/howto/unicode.rst:335 msgid "" "Python supports writing source code in UTF-8 by default, but you can use " "almost any encoding if you declare the encoding being used. This is done by " "including a special comment as either the first or second line of the source " "file::" msgstr "" "Python soporta la escritura de código fuente en UTF-8 de forma " "predeterminada, pero puede usar casi cualquier codificación si declara la " "codificación que está utilizando. Esto se hace mediante la inclusión de un " "comentario especial en la primera o segunda línea del archivo fuente::" #: ../Doc/howto/unicode.rst:345 msgid "" "The syntax is inspired by Emacs's notation for specifying variables local to " "a file. Emacs supports many different variables, but Python only supports " "'coding'. The ``-*-`` symbols indicate to Emacs that the comment is " "special; they have no significance to Python but are a convention. Python " "looks for ``coding: name`` or ``coding=name`` in the comment." msgstr "" "La sintaxis está inspirada en la notación de Emacs para especificar " "variables locales a un archivo. Emacs admite muchas variables diferentes, " "pero Python solo admite *'coding'*. Los símbolos ``- * -`` indican a Emacs " "que el comentario es especial; no tienen importancia para Python pero son " "una convención. Python busca ``coding: name`` o ``coding=name`` en el " "comentario." #: ../Doc/howto/unicode.rst:351 msgid "" "If you don't include such a comment, the default encoding used will be UTF-8 " "as already mentioned. See also :pep:`263` for more information." msgstr "" "Si no incluye dicho comentario, la codificación predeterminada utilizada " "será UTF-8 como ya se mencionó. Ver también :pep:`263` para más información." #: ../Doc/howto/unicode.rst:356 msgid "Unicode Properties" msgstr "Propiedades Unicode" #: ../Doc/howto/unicode.rst:358 msgid "" "The Unicode specification includes a database of information about code " "points. For each defined code point, the information includes the " "character's name, its category, the numeric value if applicable (for " "characters representing numeric concepts such as the Roman numerals, " "fractions such as one-third and four-fifths, etc.). There are also display-" "related properties, such as how to use the code point in bidirectional text." msgstr "" "La especificación Unicode incluye una base de datos de información sobre " "puntos de código. Para cada punto de código definido, la información incluye " "el nombre del carácter, su categoría, el valor numérico si corresponde (para " "caracteres que representan conceptos numéricos como los números romanos, " "fracciones como un tercio y cuatro quintos, etc.). También hay propiedades " "relacionadas con la visualización, como cómo usar el punto de código en " "texto bidireccional." #: ../Doc/howto/unicode.rst:366 msgid "" "The following program displays some information about several characters, " "and prints the numeric value of one particular character::" msgstr "" "El siguiente programa muestra información sobre varios caracteres e imprime " "el valor numérico de un carácter en particular::" #: ../Doc/howto/unicode.rst:380 msgid "When run, this prints:" msgstr "Cuando se ejecuta, este imprime:" #: ../Doc/howto/unicode.rst:391 msgid "" "The category codes are abbreviations describing the nature of the character. " "These are grouped into categories such as \"Letter\", \"Number\", " "\"Punctuation\", or \"Symbol\", which in turn are broken up into " "subcategories. To take the codes from the above output, ``'Ll'`` means " "'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " "nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " "Values section of the Unicode Character Database documentation `_ for a list of category " "codes." msgstr "" "Los códigos de categoría son abreviaturas que describen la naturaleza del " "personaje. Estos se agrupan en categorías como \"Letra\", \"Número\", " "\"Puntuación\" o \"Símbolo\", que a su vez se dividen en subcategorías. Para " "tomar los códigos de la salida anterior, ``'Ll'`` significa 'Letra, " "minúscula ', ``'No'`` significa \"Número, otro\", ``'Mn'`` es \"Marca, sin " "espacios\" , y ``'So'`` es \"Símbolo, otro\". Consulte `la sección Valores " "de categoría generales de la documentación de la base de datos de caracteres " "Unicode `_ " "para obtener una lista de códigos de categoría." #: ../Doc/howto/unicode.rst:402 msgid "Comparing Strings" msgstr "Comparando cadenas" #: ../Doc/howto/unicode.rst:404 msgid "" "Unicode adds some complication to comparing strings, because the same set of " "characters can be represented by different sequences of code points. For " "example, a letter like 'ê' can be represented as a single code point U+00EA, " "or as U+0065 U+0302, which is the code point for 'e' followed by a code " "point for 'COMBINING CIRCUMFLEX ACCENT'. These will produce the same output " "when printed, but one is a string of length 1 and the other is of length 2." msgstr "" "Unicode agrega algunas complicaciones a la comparación de cadenas, porque el " "mismo conjunto de caracteres puede representarse mediante diferentes " "secuencias de puntos de código. Por ejemplo, una letra como 'ê' puede " "representarse como un único punto de código U+00EA, o como U+0065 U+0302, " "que es el punto de código para 'e' seguido de un punto de código para " "'COMBINING CIRCUMFLEX ACCENT' . Estos producirán la misma salida cuando se " "impriman, pero uno es una cadena de longitud 1 y el otro es de longitud 2." #: ../Doc/howto/unicode.rst:412 msgid "" "One tool for a case-insensitive comparison is the :meth:`~str.casefold` " "string method that converts a string to a case-insensitive form following an " "algorithm described by the Unicode Standard. This algorithm has special " "handling for characters such as the German letter 'ß' (code point U+00DF), " "which becomes the pair of lowercase letters 'ss'." msgstr "" "Una herramienta para una comparación que no distingue entre mayúsculas y " "minúsculas es el método :meth:`~str.casefold` que convierte una cadena en " "una forma que no distingue entre mayúsculas y minúsculas siguiendo un " "algoritmo descrito por el estándar Unicode. Este algoritmo tiene un manejo " "especial para caracteres como la letra Alemana 'ß' (punto de código U+00DF), " "que se convierte en el par de letras minúsculas 'ss'." #: ../Doc/howto/unicode.rst:425 #, fuzzy msgid "" "A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." "normalize` function that converts strings to one of several normal forms, " "where letters followed by a combining character are replaced with single " "characters. :func:`~unicodedata.normalize` can be used to perform string " "comparisons that won't falsely report inequality if two strings use " "combining characters differently:" msgstr "" "Una segunda herramienta es la función :func:`~unicodedata.normalize` del " "módulo :mod:`unicodedata` que convierte las cadenas en una de varias formas " "normales, donde las letras seguidas de un carácter de combinación se " "reemplazan con caracteres individuales. :func:`normalize` puede usarse para " "realizar comparaciones de cadenas que no informarán falsamente la " "desigualdad si dos cadenas usan caracteres combinados de manera diferente:" #: ../Doc/howto/unicode.rst:448 msgid "When run, this outputs:" msgstr "Cuando se ejecuta, esto genera:" #: ../Doc/howto/unicode.rst:457 msgid "" "The first argument to the :func:`~unicodedata.normalize` function is a " "string giving the desired normalization form, which can be one of 'NFC', " "'NFKC', 'NFD', and 'NFKD'." msgstr "" "El primer argumento para la función :func:`~unicodedata.normalize` es una " "cadena que proporciona la forma de normalización deseada, que puede ser una " "de 'NFC', 'NFKC', 'NFD' y 'NFKD'." #: ../Doc/howto/unicode.rst:461 msgid "The Unicode Standard also specifies how to do caseless comparisons::" msgstr "" "El estándar Unicode también especifica cómo hacer comparaciones sin " "mayúsculas y minúsculas::" #: ../Doc/howto/unicode.rst:477 #, fuzzy msgid "" "This will print ``True``. (Why is :func:`!NFD` invoked twice? Because " "there are a few characters that make :meth:`~str.casefold` return a non-" "normalized string, so the result needs to be normalized again. See section " "3.13 of the Unicode Standard for a discussion and an example.)" msgstr "" "Esto imprimirá ``Verdadero``. (¿Por qué se invoca dos veces :func:`NFD`? " "Debido a que hay algunos caracteres que hacen que :meth:`casefold` retorne " "una cadena no normalizada, por lo que el resultado debe normalizarse " "nuevamente. Consulte la sección 3.13 del Estándar Unicode para una discusión " "y un ejemplo.)" #: ../Doc/howto/unicode.rst:484 msgid "Unicode Regular Expressions" msgstr "Expresiones regulares Unicode" #: ../Doc/howto/unicode.rst:486 msgid "" "The regular expressions supported by the :mod:`re` module can be provided " "either as bytes or strings. Some of the special character sequences such as " "``\\d`` and ``\\w`` have different meanings depending on whether the pattern " "is supplied as bytes or a string. For example, ``\\d`` will match the " "characters ``[0-9]`` in bytes but in strings will match any character that's " "in the ``'Nd'`` category." msgstr "" "Las expresiones regulares soportadas por el módulo :mod:`re` se pueden " "proporcionar como bytes o cadenas. Algunas de las secuencias de caracteres " "especiales como ``\\d`` y ``\\w`` tienen diferentes significados dependiendo " "de si el patrón se suministra como bytes o una cadena. Por ejemplo, ``\\d`` " "coincidirá con los caracteres ``[0-9]`` en bytes, pero en las cadenas " "coincidirá con cualquier carácter que esté en la categoría ``'Nd'``." #: ../Doc/howto/unicode.rst:493 msgid "" "The string in this example has the number 57 written in both Thai and Arabic " "numerals::" msgstr "" "La cadena en este ejemplo tiene el número 57 escrito en números tailandeses " "y árabes::" #: ../Doc/howto/unicode.rst:503 msgid "" "When executed, ``\\d+`` will match the Thai numerals and print them out. If " "you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\\d+`` will " "match the substring \"57\" instead." msgstr "" "Cuando se ejecuta, ``\\d+`` coincidirá con los números tailandeses y los " "imprimirá. Si proporciona el indicador :const:`re.ASCII` a :func:`~re." "compile`, ``\\d+`` coincidirá con la subcadena \"57\" en su lugar." #: ../Doc/howto/unicode.rst:507 msgid "" "Similarly, ``\\w`` matches a wide variety of Unicode characters but only " "``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\\s`` " "will match either Unicode whitespace characters or ``[ \\t\\n\\r\\f\\v]``." msgstr "" "Del mismo modo, ``\\w`` coincide con una amplia variedad de caracteres " "Unicode pero solo ``[a-zA-Z0-9_]`` en bytes o si :const:`re.ASCII` se " "suministra, y ``\\s`` coincidirá con los caracteres de espacio en blanco " "Unicode o ``[ \\t\\n\\r\\f\\v]``." #: ../Doc/howto/unicode.rst:518 msgid "Some good alternative discussions of Python's Unicode support are:" msgstr "" "Algunas buenas discusiones alternativas sobre el soporte Unicode de Python " "son:" #: ../Doc/howto/unicode.rst:520 #, fuzzy msgid "" "`Processing Text Files in Python 3 `_, by Nick Coghlan." msgstr "" "`Processing Text Files in Python 3 `_, por *Nick Coghlan*." #: ../Doc/howto/unicode.rst:521 msgid "" "`Pragmatic Unicode `_, a PyCon " "2012 presentation by Ned Batchelder." msgstr "" "`Pragmatic Unicode `_, una " "presentación de *Ned Batchelder* en PyCon 2012." #: ../Doc/howto/unicode.rst:523 msgid "" "The :class:`str` type is described in the Python library reference at :ref:" "`textseq`." msgstr "" "El tipo :class:`str` se describe en la referencia de la biblioteca de Python " "en :ref:`textseq`." #: ../Doc/howto/unicode.rst:526 msgid "The documentation for the :mod:`unicodedata` module." msgstr "La documentación para el módulo :mod:`unicodedata`." #: ../Doc/howto/unicode.rst:528 msgid "The documentation for the :mod:`codecs` module." msgstr "La documentación para el módulo :mod:`codecs`." #: ../Doc/howto/unicode.rst:530 msgid "" "Marc-André Lemburg gave `a presentation titled \"Python and Unicode\" (PDF " "slides) `_ at " "EuroPython 2002. The slides are an excellent overview of the design of " "Python 2's Unicode features (where the Unicode string type is called " "``unicode`` and literals start with ``u``)." msgstr "" "*Marc-André Lemburg* hizo `una presentación titulada \"Python and " "Unicode\" (diapositivas en PDF) `_ en EuroPython 2002. Las diapositivas son una excelente " "descripción general del diseño de las características Unicode de Python 2 " "(donde el tipo de cadena Unicode se llama ``unicode`` y los literales " "comienzan con ``u``)." #: ../Doc/howto/unicode.rst:538 msgid "Reading and Writing Unicode Data" msgstr "Leyendo y escribiendo datos Unicode" #: ../Doc/howto/unicode.rst:540 msgid "" "Once you've written some code that works with Unicode data, the next problem " "is input/output. How do you get Unicode strings into your program, and how " "do you convert Unicode into a form suitable for storage or transmission?" msgstr "" "Una vez que haya escrito un código que funcione con datos Unicode, el " "siguiente problema es la entrada/salida. ¿Cómo obtiene cadenas Unicode en su " "programa y cómo convierte Unicode en una forma adecuada para almacenamiento " "o transmisión?" #: ../Doc/howto/unicode.rst:544 msgid "" "It's possible that you may not need to do anything depending on your input " "sources and output destinations; you should check whether the libraries used " "in your application support Unicode natively. XML parsers often return " "Unicode data, for example. Many relational databases also support Unicode-" "valued columns and can return Unicode values from an SQL query." msgstr "" "Es posible que no necesite hacer nada dependiendo de sus fuentes de entrada " "y destinos de salida; debe verificar si las bibliotecas utilizadas en su " "aplicación son compatibles con Unicode de forma nativa. Los analizadores XML " "a menudo retornan datos Unicode, por ejemplo. Muchas bases de datos " "relacionales también admiten columnas con valores Unicode y pueden retornar " "valores Unicode de una consulta SQL." #: ../Doc/howto/unicode.rst:550 msgid "" "Unicode data is usually converted to a particular encoding before it gets " "written to disk or sent over a socket. It's possible to do all the work " "yourself: open a file, read an 8-bit bytes object from it, and convert the " "bytes with ``bytes.decode(encoding)``. However, the manual approach is not " "recommended." msgstr "" "Los datos Unicode generalmente se convierten a una codificación particular " "antes de escribirse en el disco o enviarse a través de un socket. Es posible " "hacer todo el trabajo usted mismo: abra un archivo, lea un objeto de bytes " "de 8 bits y convierta los bytes con ``bytes.decode(codificación)``. Sin " "embargo, no se recomienda el enfoque manual." #: ../Doc/howto/unicode.rst:555 msgid "" "One problem is the multi-byte nature of encodings; one Unicode character can " "be represented by several bytes. If you want to read the file in arbitrary-" "sized chunks (say, 1024 or 4096 bytes), you need to write error-handling " "code to catch the case where only part of the bytes encoding a single " "Unicode character are read at the end of a chunk. One solution would be to " "read the entire file into memory and then perform the decoding, but that " "prevents you from working with files that are extremely large; if you need " "to read a 2 GiB file, you need 2 GiB of RAM. (More, really, since for at " "least a moment you'd need to have both the encoded string and its Unicode " "version in memory.)" msgstr "" "Un problema es la naturaleza de múltiples bytes de las codificaciones; Un " "carácter Unicode puede ser representado por varios bytes. Si desea leer el " "archivo en fragmentos de tamaño arbitrario (por ejemplo, 1024 o 4096 bytes), " "debe escribir un código de manejo de errores para detectar el caso en el que " "solo una parte de los bytes que codifican un solo carácter Unicode se leen " "al final de Un trozo. Una solución sería leer todo el archivo en la memoria " "y luego realizar la decodificación, pero eso le impide trabajar con archivos " "que son extremadamente grandes; si necesita leer un archivo de 2 GB, " "necesita 2 GB de RAM. (Más, realmente, ya que por al menos un momento " "necesitarías tener tanto la cadena codificada como su versión Unicode en la " "memoria)." #: ../Doc/howto/unicode.rst:565 msgid "" "The solution would be to use the low-level decoding interface to catch the " "case of partial coding sequences. The work of implementing this has already " "been done for you: the built-in :func:`open` function can return a file-like " "object that assumes the file's contents are in a specified encoding and " "accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " "and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " "*encoding* and *errors* parameters which are interpreted just like those in :" "meth:`str.encode` and :meth:`bytes.decode`." msgstr "" "La solución sería utilizar la interfaz de decodificación de bajo nivel para " "detectar el caso de secuencias de codificación parcial. El trabajo de " "implementar esto ya se ha realizado para usted: la función incorporada :func:" "`open` puede retornar un objeto similar a un archivo que asume que el " "contenido del archivo está en una codificación especificada y acepta " "parámetros Unicode para métodos como :meth:`~io.TextIOBase.read` y :meth:" "`~io.TextIOBase.write`. Esto funciona a través de los parámetros *enconding* " "y *errors* de :func:`open` que se interpretan como los de :meth:`str.encode` " "y :meth:`bytes.decode`." #: ../Doc/howto/unicode.rst:574 msgid "Reading Unicode from a file is therefore simple::" msgstr "Por lo tanto, leer Unicode de un archivo es simple::" #: ../Doc/howto/unicode.rst:580 msgid "" "It's also possible to open files in update mode, allowing both reading and " "writing::" msgstr "" "También es posible abrir archivos en modo de actualización, lo que permite " "leer y escribir::" #: ../Doc/howto/unicode.rst:588 msgid "" "The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is " "often written as the first character of a file in order to assist with " "autodetection of the file's byte ordering. Some encodings, such as UTF-16, " "expect a BOM to be present at the start of a file; when such an encoding is " "used, the BOM will be automatically written as the first character and will " "be silently dropped when the file is read. There are variants of these " "encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-" "endian encodings, that specify one particular byte ordering and don't skip " "the BOM." msgstr "" "El carácter Unicode ``U+FEFF`` se usa como marca de orden de bytes (BOM), y " "a menudo se escribe como el primer carácter de un archivo para ayudar a la " "auto detección del orden de bytes del archivo. Algunas codificaciones, como " "UTF-16, esperan que haya una BOM al comienzo de un archivo; cuando se " "utiliza dicha codificación, la BOM se escribirá automáticamente como el " "primer carácter y se descartará en silencio cuando se lea el archivo. " "Existen variantes de estas codificaciones, como 'utf-16-le' y 'utf-16-be' " "para codificaciones 'little-endian' y 'big-endian', que especifican un orden " "de bytes particular y no omiten la BOM." #: ../Doc/howto/unicode.rst:597 msgid "" "In some areas, it is also convention to use a \"BOM\" at the start of UTF-8 " "encoded files; the name is misleading since UTF-8 is not byte-order " "dependent. The mark simply announces that the file is encoded in UTF-8. For " "reading such files, use the 'utf-8-sig' codec to automatically skip the mark " "if present." msgstr "" "En algunas áreas, también es convencional usar una \"BOM\" al comienzo de " "los archivos codificados UTF-8; el nombre es engañoso ya que UTF-8 no " "depende del orden de bytes. La marca simplemente anuncia que el archivo está " "codificado en UTF-8. Para leer dichos archivos, use el códec 'utf-8-sig' " "para omitir automáticamente la marca si está presente." #: ../Doc/howto/unicode.rst:604 msgid "Unicode filenames" msgstr "Nombres de archivos Unicode" #: ../Doc/howto/unicode.rst:606 msgid "" "Most of the operating systems in common use today support filenames that " "contain arbitrary Unicode characters. Usually this is implemented by " "converting the Unicode string into some encoding that varies depending on " "the system. Today Python is converging on using UTF-8: Python on MacOS has " "used UTF-8 for several versions, and Python 3.6 switched to using UTF-8 on " "Windows as well. On Unix systems, there will only be a :term:`filesystem " "encoding `. if you've set the " "``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default " "encoding is again UTF-8." msgstr "" "La mayoría de los sistemas operativos de uso común en la actualidad admiten " "nombres de archivo que contienen caracteres Unicode arbitrarios. Por lo " "general, esto se implementa convirtiendo la cadena Unicode en una " "codificación que varía según el sistema. Hoy Python está convergiendo en el " "uso de UTF-8: Python en MacOS ha usado UTF-8 para varias versiones, y Python " "3.6 también ha cambiado a usar UTF-8 en Windows. En los sistemas Unix, solo " "habrá un :term:`filesystem encoding `. si ha configurado las variables de entorno ``LANG`` o " "``LC_CTYPE``; si no lo ha hecho, la codificación predeterminada es " "nuevamente UTF-8." #: ../Doc/howto/unicode.rst:616 msgid "" "The :func:`sys.getfilesystemencoding` function returns the encoding to use " "on your current system, in case you want to do the encoding manually, but " "there's not much reason to bother. When opening a file for reading or " "writing, you can usually just provide the Unicode string as the filename, " "and it will be automatically converted to the right encoding for you::" msgstr "" "La función :func:`sys.getfilesystemencoding` retorna la codificación para " "usar en su sistema actual, en caso de que desee realizar la codificación " "manualmente, pero no hay muchas razones para molestarse. Al abrir un archivo " "para leer o escribir, generalmente puede proporcionar la cadena Unicode como " "nombre de archivo, y se convertirá automáticamente a la codificación " "correcta para usted::" #: ../Doc/howto/unicode.rst:626 msgid "" "Functions in the :mod:`os` module such as :func:`os.stat` will also accept " "Unicode filenames." msgstr "" "Las funciones en el módulo :mod:`os` como :func:`os.stat` también aceptarán " "nombres de archivo Unicode." #: ../Doc/howto/unicode.rst:629 msgid "" "The :func:`os.listdir` function returns filenames, which raises an issue: " "should it return the Unicode version of filenames, or should it return bytes " "containing the encoded versions? :func:`os.listdir` can do both, depending " "on whether you provided the directory path as bytes or a Unicode string. If " "you pass a Unicode string as the path, filenames will be decoded using the " "filesystem's encoding and a list of Unicode strings will be returned, while " "passing a byte path will return the filenames as bytes. For example, " "assuming the default :term:`filesystem encoding ` is UTF-8, running the following program::" msgstr "" "La función :func:`os.listdir` retorna nombres de archivo, lo que plantea un " "problema: ¿debería devolver la versión Unicode de los nombres de archivo o " "debería devolver bytes que contienen las versiones codificadas? :func:`os." "listdir` puede hacer ambas cosas, dependiendo de si proporcionó la ruta del " "directorio como bytes o una cadena Unicode. Si pasa una cadena Unicode como " "ruta, los nombres de archivo se decodificarán utilizando la codificación del " "sistema de archivos y se devolverá una lista de cadenas Unicode, mientras " "que pasar una ruta de bytes devolverá los nombres de archivo como bytes. Por " "ejemplo, suponiendo que el :term:`filesystem encoding ` predeterminado es UTF-8, al ejecutar el siguiente " "programa:" #: ../Doc/howto/unicode.rst:647 msgid "will produce the following output:" msgstr "producirá la siguiente salida:" #: ../Doc/howto/unicode.rst:655 msgid "" "The first list contains UTF-8-encoded filenames, and the second list " "contains the Unicode versions." msgstr "" "La primera lista contiene nombres de archivos codificados con UTF-8, y la " "segunda lista contiene las versiones Unicode." #: ../Doc/howto/unicode.rst:658 msgid "" "Note that on most occasions, you should can just stick with using Unicode " "with these APIs. The bytes APIs should only be used on systems where " "undecodable file names can be present; that's pretty much only Unix systems " "now." msgstr "" "Tenga en cuenta que en la mayoría de las ocasiones, debe seguir usando " "Unicode con estas API. Las API de bytes solo deben usarse en sistemas donde " "pueden estar presentes nombres de archivo no codificables; eso es " "prácticamente solo sistemas Unix ahora." #: ../Doc/howto/unicode.rst:665 msgid "Tips for Writing Unicode-aware Programs" msgstr "Consejos para escribir programas compatibles con Unicode" #: ../Doc/howto/unicode.rst:667 msgid "" "This section provides some suggestions on writing software that deals with " "Unicode." msgstr "" "Esta sección proporciona algunas sugerencias sobre cómo escribir software " "que maneje Unicode." #: ../Doc/howto/unicode.rst:670 msgid "The most important tip is:" msgstr "El consejo más importante es:" #: ../Doc/howto/unicode.rst:672 msgid "" "Software should only work with Unicode strings internally, decoding the " "input data as soon as possible and encoding the output only at the end." msgstr "" "El software solo debería funcionar con cadenas Unicode internamente, " "decodificando los datos de entrada lo antes posible y codificando la salida " "solo al final." #: ../Doc/howto/unicode.rst:675 msgid "" "If you attempt to write processing functions that accept both Unicode and " "byte strings, you will find your program vulnerable to bugs wherever you " "combine the two different kinds of strings. There is no automatic encoding " "or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be " "raised." msgstr "" "Si intenta escribir funciones de procesamiento que acepten cadenas Unicode y " "de bytes, encontrará que su programa es vulnerable a errores dondequiera que " "combine los dos tipos diferentes de cadenas. No hay codificación o " "decodificación automática: si hace, por ejemplo: ``str+bytes``, un :exc:" "`TypeError` se generará." #: ../Doc/howto/unicode.rst:680 msgid "" "When using data coming from a web browser or some other untrusted source, a " "common technique is to check for illegal characters in a string before using " "the string in a generated command line or storing it in a database. If " "you're doing this, be careful to check the decoded string, not the encoded " "bytes data; some encodings may have interesting properties, such as not " "being bijective or not being fully ASCII-compatible. This is especially " "true if the input data also specifies the encoding, since the attacker can " "then choose a clever way to hide malicious text in the encoded bytestream." msgstr "" "Cuando se usan datos que provienen de un navegador web u otra fuente no " "confiable, una técnica común es verificar si hay caracteres ilegales en una " "cadena antes de usar la cadena en una línea de comando generada o " "almacenarla en una base de datos. Si está haciendo esto, tenga cuidado de " "verificar la cadena decodificada, no los datos de bytes codificados; Algunas " "codificaciones pueden tener propiedades interesantes, como no ser biyectivo " "o no ser totalmente compatible con ASCII. Esto es especialmente cierto si " "los datos de entrada también especifican la codificación, ya que el atacante " "puede elegir una forma inteligente de ocultar el texto malicioso en el flujo " "de bytes codificado." #: ../Doc/howto/unicode.rst:691 msgid "Converting Between File Encodings" msgstr "Conversión entre codificaciones de archivo" #: ../Doc/howto/unicode.rst:693 msgid "" "The :class:`~codecs.StreamRecoder` class can transparently convert between " "encodings, taking a stream that returns data in encoding #1 and behaving " "like a stream returning data in encoding #2." msgstr "" "La clase :class:`~codecs.StreamRecoder` puede convertir de forma " "transparente entre codificaciones, tomar una secuencia que retorna datos en " "la codificación 1 y comportarse como una secuencia que retorna datos en la " "codificación 2." #: ../Doc/howto/unicode.rst:697 msgid "" "For example, if you have an input file *f* that's in Latin-1, you can wrap " "it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::" msgstr "" "Por ejemplo, si tiene un archivo de entrada *f* que está en Latin-1, puede " "envolverlo con :class:`~codecs.StreamRecoder` para retornar bytes " "codificados en UTF-8::" #: ../Doc/howto/unicode.rst:711 msgid "Files in an Unknown Encoding" msgstr "Archivos en una codificación desconocida" #: ../Doc/howto/unicode.rst:713 msgid "" "What can you do if you need to make a change to a file, but don't know the " "file's encoding? If you know the encoding is ASCII-compatible and only want " "to examine or modify the ASCII parts, you can open the file with the " "``surrogateescape`` error handler::" msgstr "" "¿Qué puede hacer si necesita hacer un cambio en un archivo, pero no conoce " "la codificación del archivo? Si sabe que la codificación es compatible con " "ASCII y solo desea examinar o modificar las partes ASCII, puede abrir el " "archivo con el manejador de errores ``surrogateescape``::" #: ../Doc/howto/unicode.rst:727 msgid "" "The ``surrogateescape`` error handler will decode any non-ASCII bytes as " "code points in a special range running from U+DC80 to U+DCFF. These code " "points will then turn back into the same bytes when the ``surrogateescape`` " "error handler is used to encode the data and write it back out." msgstr "" "El manejador de errores ``surrogateescape`` decodificará los bytes que no " "sean ASCII como puntos de código en un rango especial que va desde U+DC80 a " "U+DCFF. Estos puntos de código volverán a convertirse en los mismos bytes " "cuando se use el controlador de error ``subrogateescape`` para codificar los " "datos y volver a escribirlos." #: ../Doc/howto/unicode.rst:737 #, fuzzy msgid "" "One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" "Una sección de `Mastering Python 3 Input/Output `_, una charla de *David " "Beazley* en la PyCon 2010, analiza el procesamiento de texto y el manejo de " "datos binarios." #: ../Doc/howto/unicode.rst:741 msgid "" "The `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-" "aware Applications in Python\" `_ discuss questions of " "character encodings as well as how to internationalize and localize an " "application. These slides cover Python 2.x only." msgstr "" "El `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-aware " "Applications in Python\" `_ discute cuestiones de " "codificaciones de caracteres, así como también cómo internacionalizar y " "localizar una aplicación. Estas diapositivas cubren solo Python 2.x." #: ../Doc/howto/unicode.rst:747 #, fuzzy msgid "" "`The Guts of Unicode in Python `_ is a PyCon 2013 talk by Benjamin Peterson that " "discusses the internal Unicode representation in Python 3.3." msgstr "" "`The Guts of Unicode in Python `_ es una charla de *Benjamin Peterson* en PyCon 2013 que " "analiza la representación interna de Unicode en Python 3.3." #: ../Doc/howto/unicode.rst:754 msgid "Acknowledgements" msgstr "Agradecimientos" #: ../Doc/howto/unicode.rst:756 msgid "" "The initial draft of this document was written by Andrew Kuchling. It has " "since been revised further by Alexander Belopolsky, Georg Brandl, Andrew " "Kuchling, and Ezio Melotti." msgstr "" "El borrador inicial de este documento fue escrito por *Andrew Kuchling*. " "Desde entonces ha sido revisado por *Alexander Belopolsky, Georg Brandl, " "Andrew Kuchling y Ezio Melotti*." #: ../Doc/howto/unicode.rst:760 msgid "" "Thanks to the following people who have noted errors or offered suggestions " "on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius " "Gedminas, Kent Johnson, Ken Krugler, Marc-André Lemburg, Martin von Löwis, " "Terry J. Reedy, Serhiy Storchaka, Eryk Sun, Chad Whitacre, Graham Wideman." msgstr "" "293/5000\n" "Gracias a las siguientes personas que notaron errores u ofrecieron " "sugerencias sobre este artículo: *Éric Araujo, Nicholas Bastin, Nick " "Coghlan, Marius Gedminas, Kent Johnson, Ken Krugler, Marc-André Lemburg, " "Martin von Löwis, Terry J. Reedy, Serhiy Storchaka , Eryk Sun, Chad " "Whitacre, Graham Wideman*."