String: SetEncodingOfStringMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

SetEncodingOfStringMBS(s as string, encoding as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method XojoRuntime MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the internal value for the encoding of this string.
Example
dim s as string = "äöü"
dim t as string = ConvertEncoding(s, encodings.UTF16)
dim m as MemoryBlock = t // memoryblock has bytes from UTF16 string without knowning the encoding
dim u as string = m // convert back to a string without encoding

MsgBox u // shows wrong characters
SetEncodingOfStringMBS u, 256 // set to UTF-16
MsgBox u

Only useful on Xojo 4.5 and newer.
Some example values for encoding:

MacRoman 0Also for ASCII or binary data used.
WindowsLatin1&h0500ANSI codepage 1252
ISOLatin1&h0201ISO 8859-1
NextStepLatin&h0B01NextStep encoding
Unicode &h010016 bit Unicode
UTF8&h080001008 bit Unicode
Invalid&hFFFFFFFF(Binary)
Invalid&hFFFF(Binary)

Renamed from SetStringEncoding to SetEncodingOfString in MBS Plugin 3.1.

Some examples using this global method:

Xojo Developer Magazine

The items on this page are in the following plugins: MBS Util Plugin.


💬 Ask a question or report a problem