From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

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


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.


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.


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)

See Also

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