Encoding Clase
Definición
Representa una codificación de caracteres.Represents a character encoding.
public ref class Encoding abstract
public ref class Encoding abstract : ICloneable
public abstract class Encoding
public abstract class Encoding : ICloneable
[System.Serializable]
public abstract class Encoding
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Encoding : ICloneable
type Encoding = class
type Encoding = class
interface ICloneable
[<System.Serializable>]
type Encoding = class
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Encoding = class
interface ICloneable
Public MustInherit Class Encoding
Public MustInherit Class Encoding
Implements ICloneable
- Herencia
-
Encoding
- Derivado
- Atributos
- Implementaciones
Ejemplos
En el ejemplo siguiente se convierte una cadena de una codificación a otra.The following example converts a string from one encoding to another.
Nota
La byte[]
matriz es el único tipo de este ejemplo que contiene los datos codificados.The byte[]
array is the only type in this example that contains the encoded data. Los Char
tipos .net y String
son Unicode, por lo que la GetChars llamada descodifica los datos de nuevo a Unicode.The .NET Char
and String
types are themselves Unicode, so the GetChars call decodes the data back to Unicode.
using namespace System;
using namespace System::Text;
int main()
{
String^ unicodeString = "This string contains the unicode character Pi (\u03a0)";
// Create two different encodings.
Encoding^ ascii = Encoding::ASCII;
Encoding^ unicode = Encoding::Unicode;
// Convert the string into a byte array.
array<Byte>^unicodeBytes = unicode->GetBytes( unicodeString );
// Perform the conversion from one encoding to the other.
array<Byte>^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes );
// Convert the new Byte into[] a char and[] then into a string.
array<Char>^asciiChars = gcnew array<Char>(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length ));
ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 );
String^ asciiString = gcnew String( asciiChars );
// Display the strings created before and after the conversion.
Console::WriteLine( "Original String*: {0}", unicodeString );
Console::WriteLine( "Ascii converted String*: {0}", asciiString );
}
// The example displays the following output:
// Original string: This string contains the unicode character Pi (Π)
// Ascii converted string: This string contains the unicode character Pi (?)
using System;
using System.Text;
class Example
{
static void Main()
{
string unicodeString = "This string contains the unicode character Pi (\u03a0)";
// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding unicode = Encoding.Unicode;
// Convert the string into a byte array.
byte[] unicodeBytes = unicode.GetBytes(unicodeString);
// Perform the conversion from one encoding to the other.
byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes);
// Convert the new byte[] into a char[] and then into a string.
char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
string asciiString = new string(asciiChars);
// Display the strings created before and after the conversion.
Console.WriteLine("Original string: {0}", unicodeString);
Console.WriteLine("Ascii converted string: {0}", asciiString);
}
}
// The example displays the following output:
// Original string: This string contains the unicode character Pi (Π)
// Ascii converted string: This string contains the unicode character Pi (?)
Imports System.Text
Class Example
Shared Sub Main()
Dim unicodeString As String = "This string contains the unicode character Pi (" & ChrW(&H03A0) & ")"
' Create two different encodings.
Dim ascii As Encoding = Encoding.ASCII
Dim unicode As Encoding = Encoding.Unicode
' Convert the string into a byte array.
Dim unicodeBytes As Byte() = unicode.GetBytes(unicodeString)
' Perform the conversion from one encoding to the other.
Dim asciiBytes As Byte() = Encoding.Convert(unicode, ascii, unicodeBytes)
' Convert the new byte array into a char array and then into a string.
Dim asciiChars(ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)-1) As Char
ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0)
Dim asciiString As New String(asciiChars)
' Display the strings created before and after the conversion.
Console.WriteLine("Original string: {0}", unicodeString)
Console.WriteLine("Ascii converted string: {0}", asciiString)
End Sub
End Class
' The example displays the following output:
' Original string: This string contains the unicode character Pi (Π)
' Ascii converted string: This string contains the unicode character Pi (?)
Comentarios
Codificar es el proceso de transformar un conjunto de caracteres Unicode en una secuencia de bytes.Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. En cambio, la descodificación es el proceso de transformar una secuencia de bytes codificados en un conjunto de caracteres Unicode.In contrast, decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters. Para obtener información sobre los formatos de transformación Unicode (UTFs) y otras codificaciones admitidas por Encoding , vea codificación de caracteres en .net.For information about the Unicode Transformation Formats (UTFs) and other encodings supported by Encoding, see Character Encoding in .NET.
Tenga en cuenta que Encoding está pensado para operar en caracteres Unicode en lugar de datos binarios arbitrarios, como matrices de bytes.Note that Encoding is intended to operate on Unicode characters instead of arbitrary binary data, such as byte arrays. Si debe codificar datos binarios arbitrarios en texto, debe usar un protocolo como uuencode, que se implementa mediante métodos como Convert.ToBase64CharArray .If you must encode arbitrary binary data into text, you should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.
.NET proporciona las siguientes implementaciones de la Encoding clase para admitir las codificaciones de Unicode actuales y otras codificaciones:.NET provides the following implementations of the Encoding class to support current Unicode encodings and other encodings:
ASCIIEncodingcodifica caracteres Unicode como caracteres ASCII de 7 bits.ASCIIEncoding encodes Unicode characters as single 7-bit ASCII characters. Esta codificación solo admite valores de caracteres entre U + 0000 y U + 007F.This encoding only supports character values between U+0000 and U+007F. Página de códigos 20127.Code page 20127. También está disponible a través de la ASCII propiedad.Also available through the ASCII property.
UTF7Encodingcodifica caracteres Unicode mediante la codificación UTF-7.UTF7Encoding encodes Unicode characters using the UTF-7 encoding. Esta codificación admite todos los valores de caracteres Unicode.This encoding supports all Unicode character values. Página de códigos 65000.Code page 65000. También está disponible a través de la UTF7 propiedad.Also available through the UTF7 property.
UTF8Encodingcodifica caracteres Unicode mediante la codificación UTF-8.UTF8Encoding encodes Unicode characters using the UTF-8 encoding. Esta codificación admite todos los valores de caracteres Unicode.This encoding supports all Unicode character values. Página de códigos 65001.Code page 65001. También está disponible a través de la UTF8 propiedad.Also available through the UTF8 property.
UnicodeEncodingcodifica caracteres Unicode mediante la codificación UTF-16.UnicodeEncoding encodes Unicode characters using the UTF-16 encoding. Se admiten los pedidos de bytes little endian y big endian.Both little endian and big endian byte orders are supported. También está disponible a través de la Unicode propiedad y la BigEndianUnicode propiedad.Also available through the Unicode property and the BigEndianUnicode property.
UTF32Encodingcodifica caracteres Unicode mediante la codificación UTF-32.UTF32Encoding encodes Unicode characters using the UTF-32 encoding. Se admiten ambos little endian (página de códigos 12000) y big endian (página de códigos 12001).Both little endian (code page 12000) and big endian (code page 12001) byte orders are supported. También está disponible a través de la UTF32 propiedad.Also available through the UTF32 property.
La Encoding clase está pensada principalmente para realizar conversiones entre diferentes codificaciones y Unicode.The Encoding class is primarily intended to convert between different encodings and Unicode. A menudo, una de las clases Unicode derivadas es la opción correcta para la aplicación.Often one of the derived Unicode classes is the correct choice for your app.
Use el GetEncoding método para obtener otras codificaciones y llame al GetEncodings método para obtener una lista de todas las codificaciones.Use the GetEncoding method to obtain other encodings, and call the GetEncodings method to get a list of all encodings.
Lista de codificacionesList of encodings
En la tabla siguiente se enumeran las codificaciones admitidas por .NET.The following table lists the encodings supported by .NET. Muestra el número de página de códigos de cada codificación y los valores de las propiedades y de la codificación EncodingInfo.Name EncodingInfo.DisplayName .It lists each encoding's code page number and the values of the encoding's EncodingInfo.Name and EncodingInfo.DisplayName properties. Una marca de verificación en la columna compatibilidad con .NET Framework, compatibilidad con .net Core o .net 5,0 y versiones posteriores indica que la página de códigos es compatible de forma nativa con esa implementación de .net, independientemente de la plataforma subyacente.A check mark in the .NET Framework support, .NET Core support, or .NET 5.0 and later support column indicates that the code page is natively supported by that .NET implementation, regardless of the underlying platform. Por .NET Framework, la disponibilidad de otras codificaciones enumeradas en la tabla depende del sistema operativo.For .NET Framework, the availability of other encodings listed in the table depends on the operating system. En .NET Core y .NET 5,0 y versiones posteriores, hay otras codificaciones disponibles mediante la System.Text.CodePagesEncodingProvider clase o mediante la derivación de la System.Text.EncodingProvider clase.For .NET Core and .NET 5.0 and later, other encodings are available by using the System.Text.CodePagesEncodingProvider class or by deriving from the System.Text.EncodingProvider class.
Nota
Las páginas de códigos cuya EncodingInfo.Name propiedad corresponde a un estándar internacional no se cumplen necesariamente íntegramente con esa norma.Code pages whose EncodingInfo.Name property corresponds to an international standard do not necessarily comply in full with that standard.
Página de códigosCode page | NOMBREName | Nombre para mostrarDisplay name | Compatibilidad con .NET Framework.NET Framework support | Compatibilidad de .NET Core.NET Core support | Compatibilidad con .NET 5,0 y versiones posteriores.NET 5.0 and later support | |
---|---|---|---|---|---|---|
3737 | IBM037IBM037 | IBM EBCDIC (EE. UU.-Canadá)IBM EBCDIC (US-Canada) | ||||
437437 | IBM437IBM437 | Estados Unidos OEMOEM United States | ||||
500500 | IBM500IBM500 | IBM EBCDIC (internacional)IBM EBCDIC (International) | ||||
708708 | ASMO-708ASMO-708 | Árabe (ASMO 708)Arabic (ASMO 708) | ||||
720720 | DOS: 720DOS-720 | Árabe (DOS)Arabic (DOS) | ||||
737737 | ibm737ibm737 | Griego (DOS)Greek (DOS) | ||||
775775 | ibm775ibm775 | Báltico (DOS)Baltic (DOS) | ||||
850850 | ibm850ibm850 | Europeo occidental (DOS)Western European (DOS) | ||||
852852 | ibm852ibm852 | Centroeuropeo (DOS)Central European (DOS) | ||||
855855 | IBM855IBM855 | OEM cirílicoOEM Cyrillic | ||||
857857 | ibm857ibm857 | Turco (DOS)Turkish (DOS) | ||||
858858 | IBM00858IBM00858 | OEM latín I multilingüeOEM Multilingual Latin I | ||||
860860 | IBM860IBM860 | Portugués (DOS)Portuguese (DOS) | ||||
861861 | ibm861ibm861 | Islandés (DOS)Icelandic (DOS) | ||||
862862 | DOS: 862DOS-862 | Hebreo (DOS)Hebrew (DOS) | ||||
863863 | IBM863IBM863 | Canadiense francés (DOS)French Canadian (DOS) | ||||
864864 | IBM864IBM864 | Árabe (864)Arabic (864) | ||||
865865 | IBM865IBM865 | Nordic (DOS)Nordic (DOS) | ||||
866866 | cp866cp866 | Cirílico (DOS)Cyrillic (DOS) | ||||
869869 | ibm869ibm869 | Griego, moderno (DOS)Greek, Modern (DOS) | ||||
870870 | IBM870IBM870 | IBM EBCDIC (Latín multilingüe-2)IBM EBCDIC (Multilingual Latin-2) | ||||
874874 | Windows-874windows-874 | Tailandés (Windows)Thai (Windows) | ||||
875875 | cp875cp875 | IBM EBCDIC (Griego moderno)IBM EBCDIC (Greek Modern) | ||||
932932 | shift_jisshift_jis | Japonés (Shift-JIS)Japanese (Shift-JIS) | ||||
936936 | GB2312gb2312 | Chino simplificado (GB2312)Chinese Simplified (GB2312) | ✓✓ | |||
949949 | ks_c_5601-1987ks_c_5601-1987 | CoreanoKorean | ||||
950950 | big5big5 | Chino tradicional (Big5)Chinese Traditional (Big5) | ||||
10261026 | IBM1026IBM1026 | IBM EBCDIC (Turco latín-5)IBM EBCDIC (Turkish Latin-5) | ||||
10471047 | IBM01047IBM01047 | IBM Latin-1IBM Latin-1 | ||||
11401140 | IBM01140IBM01140 | IBM EBCDIC (EE. UU.-Canadá-euro)IBM EBCDIC (US-Canada-Euro) | ||||
11411141 | IBM01141IBM01141 | IBM EBCDIC (Alemania-Euro)IBM EBCDIC (Germany-Euro) | ||||
11421142 | IBM01142IBM01142 | IBM EBCDIC (Dinamarca-Noruega-euro)IBM EBCDIC (Denmark-Norway-Euro) | ||||
11431143 | IBM01143IBM01143 | IBM EBCDIC (Finlandia-Suecia-euro)IBM EBCDIC (Finland-Sweden-Euro) | ||||
11441144 | IBM01144IBM01144 | IBM EBCDIC (Italia-euro)IBM EBCDIC (Italy-Euro) | ||||
11451145 | IBM01145IBM01145 | IBM EBCDIC (España-Euro)IBM EBCDIC (Spain-Euro) | ||||
11461146 | IBM01146IBM01146 | IBM EBCDIC (RU-euro)IBM EBCDIC (UK-Euro) | ||||
11471147 | IBM01147IBM01147 | IBM EBCDIC (Francia-Euro)IBM EBCDIC (France-Euro) | ||||
11481148 | IBM01148IBM01148 | IBM EBCDIC (internacional-euro)IBM EBCDIC (International-Euro) | ||||
11491149 | IBM01149IBM01149 | IBM EBCDIC (islandés-euro)IBM EBCDIC (Icelandic-Euro) | ||||
12001200 | UTF-16utf-16 | UnicodeUnicode | ✓✓ | ✓✓ | ✓✓ | |
12011201 | unicodeFFFEunicodeFFFE | Unicode (Big endian)Unicode (Big endian) | ✓✓ | ✓✓ | ✓✓ | |
12501250 | Windows-1250windows-1250 | Centroeuropeo (Windows)Central European (Windows) | ||||
12511251 | Windows-1251windows-1251 | Cirílico (Windows)Cyrillic (Windows) | ||||
12521252 | Windows-1252Windows-1252 | Europeo occidental (Windows)Western European (Windows) | ✓✓ | |||
12531253 | Windows-1253windows-1253 | Griego (Windows)Greek (Windows) | ||||
12541254 | Windows-1254windows-1254 | Turco (Windows)Turkish (Windows) | ||||
12551255 | Windows-1255windows-1255 | Hebreo (Windows)Hebrew (Windows) | ||||
12561256 | Windows-1256windows-1256 | Árabe (Windows)Arabic (Windows) | ||||
12571257 | Windows-1257windows-1257 | Báltico (Windows)Baltic (Windows) | ||||
12581258 | Windows-1258windows-1258 | Vietnamita (Windows)Vietnamese (Windows) | ||||
13611361 | JohabJohab | Coreano (Johab)Korean (Johab) | ||||
1000010000 | equipomacintosh | Europa occidental (Mac)Western European (Mac) | ||||
1000110001 | x-Mac-japonésx-mac-japanese | Japonés (Mac)Japanese (Mac) | ||||
1000210002 | x-Mac-ChineseTradx-mac-chinesetrad | Chino tradicional (Mac)Chinese Traditional (Mac) | ||||
1000310003 | x-Mac-Coreanox-mac-korean | Coreano (Mac)Korean (Mac) | ✓✓ | |||
1000410004 | x-Mac-Árabex-mac-arabic | Árabe (Mac)Arabic (Mac) | ||||
1000510005 | x-Mac-hebreox-mac-hebrew | Hebreo (Mac)Hebrew (Mac) | ||||
1000610006 | x-Mac-griegox-mac-greek | Griego (Mac)Greek (Mac) | ||||
1000710007 | x-Mac-cirílicox-mac-cyrillic | Cirílico (Mac)Cyrillic (Mac) | ||||
1000810008 | x-Mac-ChineseSimpx-mac-chinesesimp | Chino simplificado (Mac)Chinese Simplified (Mac) | ✓✓ | |||
1001010010 | x-Mac-rumanox-mac-romanian | Rumano (Mac)Romanian (Mac) | ||||
1001710017 | x-Mac-ucranianox-mac-ukrainian | Ucraniano (Mac)Ukrainian (Mac) | ||||
1002110021 | x-Mac-tailandésx-mac-thai | Tailandés (Mac)Thai (Mac) | ||||
1002910029 | x-Mac-CEx-mac-ce | Centroeuropeo (Mac)Central European (Mac) | ||||
1007910079 | x-Mac-islandésx-mac-icelandic | Islandés (Mac)Icelandic (Mac) | ||||
1008110081 | x-Mac-Turcox-mac-turkish | Turco (Mac)Turkish (Mac) | ||||
1008210082 | x-Mac-croatax-mac-croatian | Croata (Mac)Croatian (Mac) | ||||
1200012000 | UTF-32utf-32 | Unicode (UTF-32)Unicode (UTF-32) | ✓✓ | ✓✓ | ✓✓ | |
1200112001 | UTF-32BEutf-32BE | Unicode (UTF-32 big endian)Unicode (UTF-32 Big endian) | ✓✓ | ✓✓ | ✓✓ | |
2000020000 | x-chino-CNSx-Chinese-CNS | Chino tradicional (CNS)Chinese Traditional (CNS) | ||||
2000120001 | x-cp20001x-cp20001 | TCA TaiwánTCA Taiwan | ||||
2000220002 | x-chino-Etenx-Chinese-Eten | Chino tradicional (Eten)Chinese Traditional (Eten) | ||||
2000320003 | x-cp20003x-cp20003 | IBM5550 TaiwánIBM5550 Taiwan | ||||
2000420004 | x-cp20004x-cp20004 | Teletexto TaiwánTeleText Taiwan | ||||
2000520005 | x-cp20005x-cp20005 | Wang TaiwánWang Taiwan | ||||
2010520105 | x-IA5x-IA5 | Europeo occidental (IA5)Western European (IA5) | ||||
2010620106 | x-IA5-alemánx-IA5-German | Alemán (IA5)German (IA5) | ||||
2010720107 | x-IA5-suecox-IA5-Swedish | Sueco (IA5)Swedish (IA5) | ||||
2010820108 | x-IA5-noruegox-IA5-Norwegian | Noruego (IA5)Norwegian (IA5) | ||||
2012720127 | US-ASCIIus-ascii | EE. UU.-ASCIIUS-ASCII | ✓✓ | ✓✓ | ✓✓ | |
2026120261 | x-cp20261x-cp20261 | T. 61T.61 | ||||
2026920269 | x-cp20269x-cp20269 | ISO-6937ISO-6937 | ||||
2027320273 | IBM273IBM273 | IBM EBCDIC (Alemania)IBM EBCDIC (Germany) | ||||
2027720277 | IBM277IBM277 | IBM EBCDIC (Dinamarca-Noruega)IBM EBCDIC (Denmark-Norway) | ||||
2027820278 | IBM278IBM278 | IBM EBCDIC (Finlandia-Suecia)IBM EBCDIC (Finland-Sweden) | ||||
2028020280 | IBM280IBM280 | IBM EBCDIC (Italia)IBM EBCDIC (Italy) | ||||
2028420284 | IBM284IBM284 | IBM EBCDIC (España)IBM EBCDIC (Spain) | ||||
2028520285 | IBM285IBM285 | IBM EBCDIC (RU)IBM EBCDIC (UK) | ||||
2029020290 | IBM290IBM290 | IBM EBCDIC (Katakana japonés)IBM EBCDIC (Japanese katakana) | ||||
2029720297 | IBM297IBM297 | IBM EBCDIC (Francia)IBM EBCDIC (France) | ||||
2042020420 | IBM420IBM420 | IBM EBCDIC (árabe)IBM EBCDIC (Arabic) | ||||
2042320423 | IBM423IBM423 | IBM EBCDIC (griego)IBM EBCDIC (Greek) | ||||
2042420424 | IBM424IBM424 | IBM EBCDIC (hebreo)IBM EBCDIC (Hebrew) | ||||
2083320833 | x-EBCDIC-KoreanExtendedx-EBCDIC-KoreanExtended | IBM EBCDIC (Coreano extendido)IBM EBCDIC (Korean Extended) | ||||
2083820838 | IBM-tailandésIBM-Thai | IBM EBCDIC (tailandés)IBM EBCDIC (Thai) | ||||
2086620866 | KOI8-rkoi8-r | Cirílico (KOI8-R)Cyrillic (KOI8-R) | ||||
2087120871 | IBM871IBM871 | IBM EBCDIC (islandés)IBM EBCDIC (Icelandic) | ||||
2088020880 | IBM880IBM880 | IBM EBCDIC (Ruso cirílico)IBM EBCDIC (Cyrillic Russian) | ||||
2090520905 | IBM905IBM905 | IBM EBCDIC (Turco)IBM EBCDIC (Turkish) | ||||
2092420924 | IBM00924IBM00924 | IBM Latin-1IBM Latin-1 | ||||
2093220932 | EUC-JPEUC-JP | Japonés (JIS 0208-1990 y 0212-1990)Japanese (JIS 0208-1990 and 0212-1990) | ||||
2093620936 | x-cp20936x-cp20936 | Chino simplificado (GB2312-80)Chinese Simplified (GB2312-80) | ✓✓ | |||
2094920949 | x-cp20949x-cp20949 | Coreano WansungKorean Wansung | ✓✓ | |||
2102521025 | cp1025cp1025 | IBM EBCDIC (cirílico Serbio-Búlgaro)IBM EBCDIC (Cyrillic Serbian-Bulgarian) | ||||
2186621866 | KOI8-ukoi8-u | Cirílico (KOI8-U)Cyrillic (KOI8-U) | ||||
2859128591 | ISO-8859-1iso-8859-1 | Europeo occidental (ISO)Western European (ISO) | ✓✓ | ✓✓ | ✓✓ | |
2859228592 | ISO-8859-2iso-8859-2 | Centroeuropeo (ISO)Central European (ISO) | ||||
2859328593 | ISO-8859-3iso-8859-3 | Latin 3 (ISO)Latin 3 (ISO) | ||||
2859428594 | ISO-8859-4iso-8859-4 | Báltico (ISO)Baltic (ISO) | ||||
2859528595 | ISO-8859-5iso-8859-5 | Cirílico (ISO)Cyrillic (ISO) | ||||
2859628596 | ISO-8859-6iso-8859-6 | Árabe (ISO)Arabic (ISO) | ||||
2859728597 | ISO-8859-7iso-8859-7 | Griego (ISO)Greek (ISO) | ||||
2859828598 | ISO-8859-8iso-8859-8 | Hebreo (ISO-Visual)Hebrew (ISO-Visual) | ✓✓ | |||
2859928599 | ISO-8859-9iso-8859-9 | Turco (ISO)Turkish (ISO) | ||||
2860328603 | ISO-8859-13iso-8859-13 | Estonio (ISO)Estonian (ISO) | ||||
2860528605 | ISO-8859-15iso-8859-15 | Latín 9 (ISO)Latin 9 (ISO) | ||||
2900129001 | x-Europax-Europa | EuropaEuropa | ||||
3859838598 | ISO-8859-8-iiso-8859-8-i | Hebreo (ISO-Logical)Hebrew (ISO-Logical) | ✓✓ | |||
5022050220 | ISO-2022-JPiso-2022-jp | Japonés (JIS)Japanese (JIS) | ✓✓ | |||
5022150221 | csISO2022JPcsISO2022JP | Japonés (JIS-permitir Kana de 1 bytes)Japanese (JIS-Allow 1 byte Kana) | ✓✓ | |||
5022250222 | ISO-2022-JPiso-2022-jp | Japonés (JIS-permitir Kana de 1 bytes-SO/SI)Japanese (JIS-Allow 1 byte Kana - SO/SI) | ✓✓ | |||
5022550225 | ISO-2022-KRiso-2022-kr | Coreano (ISO)Korean (ISO) | ✓✓ | |||
5022750227 | x-cp50227x-cp50227 | Chino simplificado (ISO-2022)Chinese Simplified (ISO-2022) | ✓✓ | |||
5193251932 | EUC-JPeuc-jp | Japonés (EUC)Japanese (EUC) | ✓✓ | |||
5193651936 | EUC-CNEUC-CN | Chino simplificado (EUC)Chinese Simplified (EUC) | ✓✓ | |||
5194951949 | EUC-KReuc-kr | Coreano (EUC)Korean (EUC) | ✓✓ | |||
5293652936 | Hz-GB-2312hz-gb-2312 | Chino simplificado (HZ)Chinese Simplified (HZ) | ✓✓ | |||
5493654936 | GB18030GB18030 | Chino simplificado (GB18030)Chinese Simplified (GB18030) | ✓✓ | |||
5700257002 | x-ISCII-dex-iscii-de | ISCII DevanagariISCII Devanagari | ✓✓ | |||
5700357003 | x-ISCII-serx-iscii-be | ISCII bengalíISCII Bengali | ✓✓ | |||
5700457004 | x-ISCII-TAx-iscii-ta | Tamil de ISCIIISCII Tamil | ✓✓ | |||
5700557005 | x-ISCII-tex-iscii-te | ISCII TeluguISCII Telugu | ✓✓ | |||
5700657006 | x-ISCII-asx-iscii-as | Equivalente de ISCIIISCII Assamese | ✓✓ | |||
5700757007 | x-ISCII-ox-iscii-or | ISCII oriyaISCII Oriya | ✓✓ | |||
5700857008 | x-ISCII-Kax-iscii-ka | Kannada de ISCIIISCII Kannada | ✓✓ | |||
5700957009 | x-ISCII-MAx-iscii-ma | ISCII MalayalamISCII Malayalam | ✓✓ | |||
5701057010 | x-ISCII-gux-iscii-gu | Gujarati (ISCII)ISCII Gujarati | ✓✓ | |||
5701157011 | x-ISCII-PAx-iscii-pa | ISCII punyabíISCII Punjabi | ✓✓ | |||
6500065000 | UTF-7utf-7 | Unicode (UTF-7)Unicode (UTF-7) | ✓✓ | ✓✓ | ||
6500165001 | utf-8utf-8 | Unicode (UTF-8)Unicode (UTF-8) | ✓✓ | ✓✓ | ✓✓ |
En el ejemplo siguiente GetEncoding(Int32) se llama GetEncoding(String) a los métodos y para obtener la codificación de la página de códigos de griego (Windows).The following example calls the GetEncoding(Int32) and GetEncoding(String) methods to get the Greek (Windows) code page encoding. Compara los Encoding objetos devueltos por las llamadas al método para mostrar que son iguales y, a continuación, Maps muestra el punto de código Unicode y el valor de la página de códigos correspondiente para cada carácter del alfabeto griego.It compares the Encoding objects returned by the method calls to show that they are equal, and then maps displays the Unicode code point and the corresponding code page value for each character in the Greek alphabet.
using System;
using System.Text;
public class Example
{
public static void Main()
{
Encoding enc = Encoding.GetEncoding(1253);
Encoding altEnc = Encoding.GetEncoding("windows-1253");
Console.WriteLine("{0} = Code Page {1}: {2}", enc.EncodingName,
altEnc.CodePage, enc.Equals(altEnc));
string greekAlphabet = "Α α Β β Γ γ Δ δ Ε ε Ζ ζ Η η " +
"Θ θ Ι ι Κ κ Λ λ Μ μ Ν ν Ξ ξ " +
"Ο ο Π π Ρ ρ Σ σ ς Τ τ Υ υ " +
"Φ φ Χ χ Ψ ψ Ω ω";
Console.OutputEncoding = Encoding.UTF8;
byte[] bytes = enc.GetBytes(greekAlphabet);
Console.WriteLine("{0,-12} {1,20} {2,20:X2}", "Character",
"Unicode Code Point", "Code Page 1253");
for (int ctr = 0; ctr < bytes.Length; ctr++) {
if (greekAlphabet[ctr].Equals(' '))
continue;
Console.WriteLine("{0,-12} {1,20} {2,20:X2}", greekAlphabet[ctr],
GetCodePoint(greekAlphabet[ctr]), bytes[ctr]);
}
}
private static string GetCodePoint(char ch)
{
string retVal = "u+";
byte[] bytes = Encoding.Unicode.GetBytes(ch.ToString());
for (int ctr = bytes.Length - 1; ctr >= 0; ctr--)
retVal += bytes[ctr].ToString("X2");
return retVal;
}
}
// The example displays the following output:
// Character Unicode Code Point Code Page 1253
// Α u+0391 C1
// α u+03B1 E1
// Β u+0392 C2
// β u+03B2 E2
// Γ u+0393 C3
// γ u+03B3 E3
// Δ u+0394 C4
// δ u+03B4 E4
// Ε u+0395 C5
// ε u+03B5 E5
// Ζ u+0396 C6
// ζ u+03B6 E6
// Η u+0397 C7
// η u+03B7 E7
// Θ u+0398 C8
// θ u+03B8 E8
// Ι u+0399 C9
// ι u+03B9 E9
// Κ u+039A CA
// κ u+03BA EA
// Λ u+039B CB
// λ u+03BB EB
// Μ u+039C CC
// μ u+03BC EC
// Ν u+039D CD
// ν u+03BD ED
// Ξ u+039E CE
// ξ u+03BE EE
// Ο u+039F CF
// ο u+03BF EF
// Π u+03A0 D0
// π u+03C0 F0
// Ρ u+03A1 D1
// ρ u+03C1 F1
// Σ u+03A3 D3
// σ u+03C3 F3
// ς u+03C2 F2
// Τ u+03A4 D4
// τ u+03C4 F4
// Υ u+03A5 D5
// υ u+03C5 F5
// Φ u+03A6 D6
// φ u+03C6 F6
// Χ u+03A7 D7
// χ u+03C7 F7
// Ψ u+03A8 D8
// ψ u+03C8 F8
// Ω u+03A9 D9
// ω u+03C9 F9
Imports System.Text
Module Example
Public Sub Main()
Dim enc As Encoding = Encoding.GetEncoding(1253)
Dim altEnc As Encoding = Encoding.GetEncoding("windows-1253")
Console.WriteLine("{0} = Code Page {1}: {2}", enc.EncodingName,
altEnc.CodePage, enc.Equals(altEnc))
Dim greekAlphabet As String = "Α α Β β Γ γ Δ δ Ε ε Ζ ζ Η η " +
"Θ θ Ι ι Κ κ Λ λ Μ μ Ν ν Ξ ξ " +
"Ο ο Π π Ρ ρ Σ σ ς Τ τ Υ υ " +
"Φ φ Χ χ Ψ ψ Ω ω"
Console.OutputEncoding = Encoding.UTF8
Dim bytes() As Byte = enc.GetBytes(greekAlphabet)
Console.WriteLine("{0,-12} {1,20} {2,20:X2}", "Character",
"Unicode Code Point", "Code Page 1253")
For ctr As Integer = 0 To bytes.Length - 1
If greekAlphabet(ctr).Equals(" "c) Then Continue For
Console.WriteLine("{0,-12} {1,20} {2,20:X2}", greekAlphabet(ctr),
GetCodePoint(greekAlphabet(ctr)), bytes(ctr))
Next
End Sub
Private Function GetCodePoint(ch As String) As String
Dim retVal As String = "u+"
Dim bytes() As Byte = Encoding.Unicode.GetBytes(ch)
For ctr As Integer = bytes.Length - 1 To 0 Step -1
retVal += bytes(ctr).ToString("X2")
Next
Return retVal
End Function
End Module
' The example displays the following output:
' Character Unicode Code Point Code Page 1253
' Α u+0391 C1
' α u+03B1 E1
' Β u+0392 C2
' β u+03B2 E2
' Γ u+0393 C3
' γ u+03B3 E3
' Δ u+0394 C4
' δ u+03B4 E4
' Ε u+0395 C5
' ε u+03B5 E5
' Ζ u+0396 C6
' ζ u+03B6 E6
' Η u+0397 C7
' η u+03B7 E7
' Θ u+0398 C8
' θ u+03B8 E8
' Ι u+0399 C9
' ι u+03B9 E9
' Κ u+039A CA
' κ u+03BA EA
' Λ u+039B CB
' λ u+03BB EB
' Μ u+039C CC
' μ u+03BC EC
' Ν u+039D CD
' ν u+03BD ED
' Ξ u+039E CE
' ξ u+03BE EE
' Ο u+039F CF
' ο u+03BF EF
' Π u+03A0 D0
' π u+03C0 F0
' Ρ u+03A1 D1
' ρ u+03C1 F1
' Σ u+03A3 D3
' σ u+03C3 F3
' ς u+03C2 F2
' Τ u+03A4 D4
' τ u+03C4 F4
' Υ u+03A5 D5
' υ u+03C5 F5
' Φ u+03A6 D6
' φ u+03C6 F6
' Χ u+03A7 D7
' χ u+03C7 F7
' Ψ u+03A8 D8
' ψ u+03C8 F8
' Ω u+03A9 D9
' ω u+03C9 F9
Si los datos que se van a convertir solo están disponibles en bloques secuenciales (como los datos leídos de una secuencia) o si la cantidad de datos es tan grande que debe dividirse en bloques más pequeños, debe utilizar Decoder o Encoder proporcionado por el GetDecoder método o el GetEncoder método, respectivamente, de una clase derivada.If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, you should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.
Los codificadores UTF-16 y UTF-32 pueden usar el orden de bytes big endian (byte más significativo primero) o el orden de bytes little endian (primero el byte menos significativo).The UTF-16 and the UTF-32 encoders can use the big endian byte order (most significant byte first) or the little endian byte order (least significant byte first). Por ejemplo, la letra mayúscula latina A (U + 0041) se serializa como se indica A continuación (en hexadecimal):For example, the Latin Capital Letter A (U+0041) is serialized as follows (in hexadecimal):
Orden de bytes UTF-16 big endian: 00 41UTF-16 big endian byte order: 00 41
Orden de bytes UTF-16 little endian: 41 00UTF-16 little endian byte order: 41 00
UTF-32 big endian orden de bytes: 00 00 00 41UTF-32 big endian byte order: 00 00 00 41
UTF-32 little endian orden de bytes: 41 00 00 00UTF-32 little endian byte order: 41 00 00 00
Por lo general, es más eficaz almacenar caracteres Unicode mediante el orden de bytes nativo.It is generally more efficient to store Unicode characters using the native byte order. Por ejemplo, es mejor usar el orden de little endian bytes en little endian plataformas, como los equipos Intel.For example, it is better to use the little endian byte order on little endian platforms, such as Intel computers.
El GetPreamble método recupera una matriz de bytes que incluye la marca de orden de bytes (BOM).The GetPreamble method retrieves an array of bytes that includes the byte order mark (BOM). Si esta matriz de bytes tiene como prefijo una secuencia codificada, ayuda al descodificador a identificar el formato de codificación utilizado.If this byte array is prefixed to an encoded stream, it helps the decoder to identify the encoding format used.
Para obtener más información sobre el orden de bytes y la marca de orden de bytes, vea el estándar Unicode en la Página principal de Unicode.For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.
Tenga en cuenta que las clases de codificación permiten errores para:Note that the encoding classes allow errors to:
Cambiar de forma silenciosa a un carácter "?".Silently change to a "?" character.
Use el carácter "mejor ajuste".Use a "best fit" character.
Cambie a un comportamiento específico de la aplicación mediante el uso de las EncoderFallback DecoderFallback clases y con el carácter de reemplazo Unicode U + FFFD.Change to an application-specific behavior through use of the EncoderFallback and DecoderFallback classes with the U+FFFD Unicode replacement character.
Debe producirse una excepción en cualquier error de flujo de datos.You should throw an exception on any data stream error. Una aplicación usa una marca "throwOnError" cuando es aplicable o utiliza las EncoderExceptionFallback DecoderExceptionFallback clases y.An app either uses a "throwonerror" flag when applicable or uses the EncoderExceptionFallback and DecoderExceptionFallback classes. La reserva con ajuste perfecto no suele ser recomendable, ya que puede provocar la pérdida de datos o confusiones, y es más lenta que el reemplazo de caracteres sencillo.Best fit fallback is often not recommended because it can cause data loss or confusion and is slower than simple character replacements. En el caso de las codificaciones ANSI, el comportamiento de ajuste perfecto es el valor predeterminado.For ANSI encodings, the best fit behavior is the default.
Constructores
Encoding() |
Inicializa una nueva instancia de la clase Encoding.Initializes a new instance of the Encoding class. |
Encoding(Int32) |
Inicializa una nueva instancia de la clase Encoding que corresponde a la página de códigos especificada.Initializes a new instance of the Encoding class that corresponds to the specified code page. |
Encoding(Int32, EncoderFallback, DecoderFallback) |
Inicializa una nueva instancia de la clase Encoding que corresponde a la página de códigos indicada que tiene las estrategias de reserva de codificador y descodificador especificadas.Initializes a new instance of the Encoding class that corresponds to the specified code page with the specified encoder and decoder fallback strategies. |
Propiedades
ASCII |
Obtiene una codificación para el juego de caracteres ASCII (de 7 bits).Gets an encoding for the ASCII (7-bit) character set. |
BigEndianUnicode |
Obtiene una codificación para el formato UTF-16 que utiliza el orden de bytes big endian.Gets an encoding for the UTF-16 format that uses the big endian byte order. |
BodyName |
Cuando se reemplaza en una clase derivada, obtiene un nombre para la codificación actual que se puede utilizar con etiquetas de cuerpo de un programa de correo.When overridden in a derived class, gets a name for the current encoding that can be used with mail agent body tags. |
CodePage |
Cuando se reemplaza en una clase derivada, obtiene el identificador de la página de códigos de la clase Encoding actual.When overridden in a derived class, gets the code page identifier of the current Encoding. |
DecoderFallback |
Obtiene o establece el objeto DecoderFallback para el objeto Encoding actual.Gets or sets the DecoderFallback object for the current Encoding object. |
Default |
Obtiene la codificación predeterminada para esta implementación de .NET.Gets the default encoding for this .NET implementation. |
EncoderFallback |
Obtiene o establece el objeto EncoderFallback para el objeto Encoding actual.Gets or sets the EncoderFallback object for the current Encoding object. |
EncodingName |
Cuando se reemplaza en una clase derivada, obtiene la descripción inteligible de la codificación actual.When overridden in a derived class, gets the human-readable description of the current encoding. |
HeaderName |
Cuando se reemplaza en una clase derivada, obtiene un nombre para la codificación actual que se puede utilizar con etiquetas de encabezado de un programa de correo.When overridden in a derived class, gets a name for the current encoding that can be used with mail agent header tags. |
IsBrowserDisplay |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si los clientes del explorador pueden utilizar la codificación actual para mostrar el contenido.When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for displaying content. |
IsBrowserSave |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si los clientes del explorador pueden utilizar la codificación actual para guardar el contenido.When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for saving content. |
IsMailNewsDisplay |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si los clientes de correo y de noticias pueden utilizar la codificación actual para mostrar el contenido.When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. |
IsMailNewsSave |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si los clientes de correo y de noticias pueden utilizar la codificación actual para guardar el contenido.When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for saving content. |
IsReadOnly |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si la codificación actual es de solo lectura.When overridden in a derived class, gets a value indicating whether the current encoding is read-only. |
IsSingleByte |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si la codificación actual utiliza puntos de código de un solo byte.When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points. |
Latin1 |
Obtiene una codificación para el juego de caracteres Latin1 (ISO-8859-1).Gets an encoding for the Latin1 character set (ISO-8859-1). |
Preamble |
Cuando se invalida en una clase derivada, devuelve un intervalo que contiene la secuencia de bytes que especifica la codificación utilizada.When overridden in a derived class, returns a span containing the sequence of bytes that specifies the encoding used. |
Unicode |
Obtiene una codificación para el formato UTF-16 utilizando el orden de bytes little endian.Gets an encoding for the UTF-16 format using the little endian byte order. |
UTF32 |
Obtiene una codificación para el formato UTF-32 utilizando el orden de bytes little endian.Gets an encoding for the UTF-32 format using the little endian byte order. |
UTF7 |
Obsoleto.
Obtiene una codificación para el formato UTF-7.Gets an encoding for the UTF-7 format. |
UTF8 |
Obtiene una codificación para el formato UTF-8.Gets an encoding for the UTF-8 format. |
WebName |
Cuando se reemplaza en una clase derivada, obtiene el nombre registrado en IANA (Internet Assigned Numbers Authority) para la codificación actual.When overridden in a derived class, gets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding. |
WindowsCodePage |
Cuando se reemplaza en una clase derivada, obtiene la página de códigos del sistema operativo Windows que se corresponde mejor con la codificación actual.When overridden in a derived class, gets the Windows operating system code page that most closely corresponds to the current encoding. |
Métodos
Clone() |
Cuando se reemplaza en una clase derivada, crea una copia superficial del objeto Encoding actual.When overridden in a derived class, creates a shallow copy of the current Encoding object. |
Convert(Encoding, Encoding, Byte[]) |
Convierte una matriz de bytes completa de una codificación a otra.Converts an entire byte array from one encoding to another. |
Convert(Encoding, Encoding, Byte[], Int32, Int32) |
Convierte un intervalo de bytes de una matriz de una codificación a otra.Converts a range of bytes in a byte array from one encoding to another. |
CreateTranscodingStream(Stream, Encoding, Encoding, Boolean) |
Crea un elemento Stream que sirve para transcodificar datos entre un elemento Encoding interior y otro Encoding exterior, similar a Convert(Encoding, Encoding, Byte[]).Creates a Stream that serves to transcode data between an inner Encoding and an outer Encoding, similar to Convert(Encoding, Encoding, Byte[]). |
Equals(Object) |
Determina si el objeto Object especificado es igual a la instancia actual.Determines whether the specified Object is equal to the current instance. |
GetByteCount(Char*, Int32) |
Cuando se reemplaza en una clase derivada, calcula el número de bytes que se generan al codificar un juego de caracteres a partir del puntero de caracteres especificado.When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer. |
GetByteCount(Char[]) |
Cuando se reemplaza en una clase derivada, calcula el número de bytes que se generan al codificar todos los caracteres de la matriz de caracteres especificada.When overridden in a derived class, calculates the number of bytes produced by encoding all the characters in the specified character array. |
GetByteCount(Char[], Int32, Int32) |
Cuando se reemplaza en una clase derivada, calcula el número de bytes que se generan al codificar un juego de caracteres de la matriz de caracteres especificada.When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array. |
GetByteCount(ReadOnlySpan<Char>) |
Cuando se invalida en una clase derivada, calcula el número de bytes que se generan al codificar los caracteres del intervalo de caracteres especificado.When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified character span. |
GetByteCount(String) |
Cuando se reemplaza en una clase derivada, calcula el número de bytes que se generan al codificar los caracteres de la cadena especificada.When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified string. |
GetByteCount(String, Int32, Int32) |
Cuando se invalida en una clase derivada, calcula el número de bytes que se generan al codificar un juego de caracteres a partir de la cadena especificada.When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified string. |
GetBytes(Char*, Int32, Byte*, Int32) |
Cuando se reemplaza en una clase derivada, codifica un juego de caracteres a partir del puntero de caracteres especificado en una secuencia de bytes que se almacenan a partir del puntero de bytes especificado.When overridden in a derived class, encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer. |
GetBytes(Char[]) |
Cuando se reemplaza en una clase derivada, codifica todos los caracteres de la matriz de caracteres especificada en una secuencia de bytes.When overridden in a derived class, encodes all the characters in the specified character array into a sequence of bytes. |
GetBytes(Char[], Int32, Int32) |
Cuando se reemplaza en una clase derivada, codifica un juego de caracteres de la matriz de caracteres especificada en una secuencia de bytes.When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes. |
GetBytes(Char[], Int32, Int32, Byte[], Int32) |
Cuando se reemplaza en una clase derivada, codifica un juego de caracteres de la matriz de caracteres especificada en la matriz de bytes especificada.When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array. |
GetBytes(ReadOnlySpan<Char>, Span<Byte>) |
Cuando se invalida en una clase derivada, codifica en un intervalo de bytes un juego de caracteres a partir del intervalo de solo lectura especificado.When overridden in a derived class, encodes into a span of bytes a set of characters from the specified read-only span. |
GetBytes(String) |
Cuando se reemplaza en una clase derivada, codifica todos los caracteres de la cadena especificada en una secuencia de bytes.When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes. |
GetBytes(String, Int32, Int32) |
Cuando se invalida en una clase derivada, codifica en una matriz de bytes el número de caracteres especificado por |
GetBytes(String, Int32, Int32, Byte[], Int32) |
Cuando se reemplaza en una clase derivada, codifica un juego de caracteres de la cadena especificada en la matriz de bytes especificada.When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array. |
GetCharCount(Byte*, Int32) |
Cuando se reemplaza en una clase derivada, calcula el número de caracteres que se generan al descodificar una secuencia de bytes a partir del puntero de bytes especificado.When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer. |
GetCharCount(Byte[]) |
Cuando se reemplaza en una clase derivada, calcula el número de caracteres que se generan al descodificar todos los bytes de la matriz de bytes especificada.When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in the specified byte array. |
GetCharCount(Byte[], Int32, Int32) |
Cuando se reemplaza en una clase derivada, calcula el número de caracteres que se generan al descodificar una secuencia de bytes de la matriz de bytes especificada.When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. |
GetCharCount(ReadOnlySpan<Byte>) |
Cuando se invalida en una clase derivada, calcula el número de caracteres que se generan al descodificar el intervalo de bytes de solo lectura proporcionado.When overridden in a derived class, calculates the number of characters produced by decoding the provided read-only byte span. |
GetChars(Byte*, Int32, Char*, Int32) |
Cuando se reemplaza en una clase derivada, descodifica una secuencia de bytes a partir del puntero de bytes especificado en un juego de caracteres que se almacenan a partir del puntero de caracteres especificado.When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer. |
GetChars(Byte[]) |
Cuando se reemplaza en una clase derivada, descodifica todos los bytes de la matriz de bytes especificada en un juego de caracteres.When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters. |
GetChars(Byte[], Int32, Int32) |
Cuando se reemplaza en una clase derivada, descodifica una secuencia de bytes de la matriz de bytes especificada en un juego de caracteres.When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters. |
GetChars(Byte[], Int32, Int32, Char[], Int32) |
Cuando se reemplaza en una clase derivada, descodifica una secuencia de bytes de la matriz de bytes especificada en la matriz de caracteres especificada.When overridden in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array. |
GetChars(ReadOnlySpan<Byte>, Span<Char>) |
Cuando se invalida en una clase derivada, descodifica todos los bytes del intervalo de bytes de solo lectura especificado en un intervalo de caracteres.When overridden in a derived class, decodes all the bytes in the specified read-only byte span into a character span. |
GetDecoder() |
Cuando se reemplaza en una clase derivada, obtiene un descodificador que convierte una secuencia de bytes codificada en una secuencia de caracteres.When overridden in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters. |
GetEncoder() |
Cuando se reemplaza en una clase derivada, obtiene un codificador que convierte una secuencia de caracteres Unicode en una secuencia de bytes codificada.When overridden in a derived class, obtains an encoder that converts a sequence of Unicode characters into an encoded sequence of bytes. |
GetEncoding(Int32) |
Devuelve la codificación asociada al identificador de página de códigos especificado.Returns the encoding associated with the specified code page identifier. |
GetEncoding(Int32, EncoderFallback, DecoderFallback) |
Devuelve la codificación asociada al identificador de página de códigos especificado.Returns the encoding associated with the specified code page identifier. Los parámetros especifican un controlador de errores para los caracteres que no se pueden codificar y para las secuencias de bytes que no se pueden descodificar.Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded. |
GetEncoding(String) |
Devuelve la codificación asociada al nombre especificado de la página de códigos.Returns the encoding associated with the specified code page name. |
GetEncoding(String, EncoderFallback, DecoderFallback) |
Devuelve la codificación asociada al nombre especificado de la página de códigos.Returns the encoding associated with the specified code page name. Los parámetros especifican un controlador de errores para los caracteres que no se pueden codificar y para las secuencias de bytes que no se pueden descodificar.Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded. |
GetEncodings() |
Devuelve una matriz que contiene todas las codificaciones.Returns an array that contains all encodings. |
GetHashCode() |
Devuelve el código hash de la instancia actual.Returns the hash code for the current instance. |
GetMaxByteCount(Int32) |
Cuando se reemplaza en una clase derivada, calcula el número máximo de bytes que se generan al codificar el número de caracteres especificado.When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters. |
GetMaxCharCount(Int32) |
Cuando se reemplaza en una clase derivada, calcula el número máximo de caracteres que se generan al descodificar el número de bytes especificado.When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes. |
GetPreamble() |
Cuando se reemplaza en una clase derivada, devuelve una secuencia de bytes que especifica la codificación utilizada.When overridden in a derived class, returns a sequence of bytes that specifies the encoding used. |
GetString(Byte*, Int32) |
Cuando se reemplaza en una clase derivada, descodifica un número determinado de bytes a partir de una dirección especificada en una cadena.When overridden in a derived class, decodes a specified number of bytes starting at a specified address into a string. |
GetString(Byte[]) |
Cuando se reemplaza en una clase derivada, descodifica todos los bytes de la matriz de bytes especificada en una cadena.When overridden in a derived class, decodes all the bytes in the specified byte array into a string. |
GetString(Byte[], Int32, Int32) |
Cuando se reemplaza en una clase derivada, descodifica una secuencia de bytes de la matriz de bytes especificada en una cadena.When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string. |
GetString(ReadOnlySpan<Byte>) |
Cuando se invalida en una clase derivada, descodifica todos los bytes del intervalo de bytes especificado en una cadena.When overridden in a derived class, decodes all the bytes in the specified byte span into a string. |
GetType() |
Obtiene el Type de la instancia actual.Gets the Type of the current instance. (Heredado de Object) |
IsAlwaysNormalized() |
Obtiene un valor que indica si la codificación actual siempre se normaliza, utilizando la forma de normalización predeterminada.Gets a value indicating whether the current encoding is always normalized, using the default normalization form. |
IsAlwaysNormalized(NormalizationForm) |
Cuando se reemplaza en una clase derivada, obtiene un valor que indica si la codificación actual siempre se normaliza mediante la forma de normalización especificada.When overridden in a derived class, gets a value indicating whether the current encoding is always normalized, using the specified normalization form. |
MemberwiseClone() |
Crea una copia superficial del Object actual.Creates a shallow copy of the current Object. (Heredado de Object) |
RegisterProvider(EncodingProvider) |
Registra un proveedor de codificación.Registers an encoding provider. |
ToString() |
Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object. (Heredado de Object) |
Métodos de extensión
GetBytes(Encoding, ReadOnlySequence<Char>) |
Codifica el elemento ReadOnlySequence<T> especificado en una matriz Byte mediante el elemento Encoding especificado.Encodes the specified ReadOnlySequence<T> into a Byte array using the specified Encoding. |
GetBytes(Encoding, ReadOnlySequence<Char>, IBufferWriter<Byte>) |
Descodifica el elemento ReadOnlySequence<T> especificado en |
GetBytes(Encoding, ReadOnlySequence<Char>, Span<Byte>) |
Codifica el elemento ReadOnlySequence<T> especificado en |
GetBytes(Encoding, ReadOnlySpan<Char>, IBufferWriter<Byte>) |
Codifica el elemento ReadOnlySpan<T> especificado en |
GetChars(Encoding, ReadOnlySequence<Byte>, IBufferWriter<Char>) |
Descodifica el elemento ReadOnlySequence<T> especificado en |
GetChars(Encoding, ReadOnlySequence<Byte>, Span<Char>) |
Descodifica el elemento ReadOnlySequence<T> especificado en |
GetChars(Encoding, ReadOnlySpan<Byte>, IBufferWriter<Char>) |
Descodifica el elemento ReadOnlySpan<T> especificado en |
GetString(Encoding, ReadOnlySequence<Byte>) |
Descodifica el elemento ReadOnlySequence<T> especificado en String mediante el elemento Encoding especificado.Decodes the specified ReadOnlySequence<T> into a String using the specified Encoding. |