| Codepage Class |
Represents a code page in the sense of a Encoding object, using a mechanism that allows basic manipulations on a system where support for the code page may not be installed.
Normally the Codepage object is constructed from an Encoding object, but for persistence it can be constructed from a string.
If the code page is supported by the local machine you can use the Encoding property to retrieve the corresponding .NET encoding object. If you access this property for a code page that is not supported on this machine this will result in a UnsupportedCodepageException.
Using this mechanism as opposed to directly using the Encoding class means that we can still work with files for which a code page is not supported on a certain machine (at least as long as no code page conversion operations are needed). This may be a common use case when a file is converted on one system and then edited on another.
Use the IsValid and IsSupported properties to determine if the codepage has been set and if it is supported on this system.
Namespace: Sdl.Core.Globalization
The Codepage type exposes the following members.
| Name | Description | |
|---|---|---|
| Codepage |
Constructs an invalid code page object (does not set a code page name).
| |
| Codepage(String) |
Construction from a code page name.
See the Name property for information about what is considered
to be a valid code page name.
| |
| Codepage(Encoding) |
Initializes a new instance of the Codepage class from an existing .NET Encoding.
| |
| Codepage(Codepage) |
Create a deep clone of the other object.
|
| Name | Description | |
|---|---|---|
| Encoding |
Returns the .NET Encoding that corresponds to this code page.
If the code page is null this property returns null.
If the encoding is not supported on this system
an UnsupportedCodepageException is thrown.
| |
| IsSupported |
True if the code page is supported on this system.
| |
| IsValid |
True if a code page name has been set.
| |
| Name |
The IANA preferred name of the code page, e.g. windows-1252 or iso-8859-1.
|
| Name | Description | |
|---|---|---|
| Clone |
Return a deep clone of this object.
| |
| Equals |
Case-sensitive comparison on whether the code page names are the same.
(Overrides ObjectEquals(Object).) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode |
Hash code based on the code page name, or 0 if none.
(Overrides ObjectGetHashCode.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ToString |
The code page name.
(Overrides ObjectToString.) |