Click or drag to resize
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.

Inheritance Hierarchy
SystemObject
  Sdl.Core.GlobalizationCodepage

Namespace: Sdl.Core.Globalization
Assembly: Sdl.Core.Globalization (in Sdl.Core.Globalization.dll) Version: 1.8.0.0 (1.8.2687.0)
Syntax
[SerializableAttribute]
public class Codepage : ICloneable

The Codepage type exposes the following members.

Constructors
  NameDescription
Public methodCodepage
Constructs an invalid code page object (does not set a code page name).
Public methodCodepage(String)
Construction from a code page name. See the Name property for information about what is considered to be a valid code page name.
Public methodCodepage(Encoding)
Initializes a new instance of the Codepage class from an existing .NET Encoding.
Protected methodCodepage(Codepage)
Create a deep clone of the other object.
Top
Properties
  NameDescription
Public propertyEncoding
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.
Public propertyIsSupported
True if the code page is supported on this system.
Public propertyIsValid
True if a code page name has been set.
Public propertyName
The IANA preferred name of the code page, e.g. windows-1252 or iso-8859-1.
Top
Methods
  NameDescription
Public methodClone
Return a deep clone of this object.
Public methodEquals
Case-sensitive comparison on whether the code page names are the same.
(Overrides ObjectEquals(Object).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Hash code based on the code page name, or 0 if none.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
The code page name.
(Overrides ObjectToString.)
Top
See Also
Community
Edit

Be the first to Edit the community content of this topic.
Comments