GetTextConverter

From Xojo Documentation
Jump to: navigation, search
Method

Creates a TextConverter object for converting between two encodings. It also works if the input encoding and output encoding are the same.

Syntax

result=GetTextConverter(inputEncoding, outputEncoding)

Part Type Description
result TextConverter Object of type TextConverter, used to perform conversion from InputEncoding to OutputEncoding.
inputEncoding TextEncoding Input text encoding.
outputEncoding TextEncoding 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.DrawString. 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.

Examples

The following example converts the text in a TextField:

Dim c As TextConverter
c = GetTextConverter(GetTextEncoding(&h500), GetTextEncoding(0))
TextField2.Text = c.Convert(TextField1.Text)

See Also

ConvertEncoding, DefineEncoding, Encoding, GetFontTextEncoding, GetInternetTextEncoding, GetTextEncoding functions; TextConverter, TextEncoding classes; Encodings module.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About