Method
GetTextConverter
Description
Creates a TextConverter object for converting between two encodings. It also works if the input encoding and output encoding are the same.
Usage
result = GetTextConverter(inputEncoding, outputEncoding)
Part |
Type |
Description |
---|---|---|
result |
Object of type TextConverter, used to perform conversion from InputEncoding to OutputEncoding. |
|
inputEncoding |
Input text encoding. |
|
outputEncoding |
Output text encoding. |
Notes
Every string may internally have a record of its encoding as well as the bytes that constitute its actual text. In many cases, the encoding is unknown, but any string returned by a TextConverter will have a known encoding, and so will be treated properly by TextFields and Graphics.DrawText. This is why it may sometimes be useful to get a TextConverter where the input and output encodings are the same; it provides a way to make sure that your app knows what encoding a string represents.
Sample code
The following example converts the text in a TextField:
Var c As TextConverter
c = GetTextConverter(GetTextEncoding(&h500), GetTextEncoding(0))
TextField2.Text = c.Convert(TextField1.Text)
Compatibility
All project types on all supported operating systems.
See also
ConvertEncoding, DefineEncoding, Encoding, GetFontTextEncoding, GetInternetTextEncoding, GetTextEncoding functions; TextConverter, TextEncoding classes; Encodings module.